Android Studio - Appcompat build fail values-v23/styles_bases.xml - android

I'll start from what I want to achieve: building the googlecast-manager example provided here: https://github.com/googlecast/GameManagerSamples
I followed instructions here: https://developers.google.com/cast/docs/android_sender
So first I downloaded from github the project, then with the Android SDK Manager I downloaded Android Support Libraries and Google play Services. Then in my project, I went to "Open Modules Setting->Add" then went to "Android SDK\extras\android\support\v7\appcompat" and added it.
Then first step to ensure it's working is to build it. So I right clicked on appcompat->"Compile Module Appcompat" but it fails with 2 errors:
Error:(20, -1) android-apt-compiler: [appcompat] D:\Android
SDK\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20:
error: Error retrieving parent for item: No resource found that
matches the given name 'android:Widget.Material.Button.Colored'.
Error:(19, -1) android-apt-compiler: [appcompat] D:\Android
SDK\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19:
error: Error retrieving parent for item: No resource found that
matches the given name
'android:TextAppearance.Material.Widget.Button.Inverse'.
Doing the same for Google Play works like a charm.
I've tried to find videos/other similar issues but it's either too complicated or not my problem.
Here is the AndroidManifest.xml of appcompat:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.appcompat">
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="19"/>
<application />
Here is what is installed from the Android SDK Manager:

I also encountered the same problem and now have fixed it. What you just have to do is
Inside your Android Studio
press Shift button two times, a search box will appear type build.gradle
choose build.gradle module:app from the suggestion.
major version of compileSdkVersion and support libraries under dependencies should be same as following code depict.
Inside Eclipse
find build.gradle module:app and do the same.
Note: download and install properly the latest API which is now API 23.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.inzi.app"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}

I believe you should upgrade your compileSdkVersion. Check your build.grade file, should be something like:
android {
compileSdkVersion 23 // <- here
buildToolsVersion "23.0.0" // <- here
defaultConfig {
applicationId "your.id"
minSdkVersion 11
targetSdkVersion 23 // <- and maybe here
versionCode 1
versionName "1.0"
}
buildTypes {
....
}
}
Of course you will need to download the newest Android SDK and build tools (and whatever else you need) from the SDK Manager.

If you are working in Eclipse do the following:
In your AndroidManifest.xml file change android:targetSdkVersion to 23
Open Project settings (ALT + Enter while focused in Project Explorer)
Go to Android tab and in Project Build Target section mark Android 6.0
Clean and build your project
NOTE: when you do this have in mind that Android OS would treat your app as if it was designed to work on Android M. So for example if you use some dangerous permissions you should add routines to check then on runtime.

You have to update your SDK to the API 23 that is either not downloaded or not installed properly.
In your build.gradle set
compileSdkVersion 23
buildToolsVersion "23.0.0"
targetSdkVersion 23
compile 'com.android.support:appcompat-v7:23.0.0'

I actually found the answer for my problem and the person above was right. The Module SDK set to compile the module was 22.0 and not 23.0. To fix that I did the following.
Right click on appcompat: "Open Module Setting -> Modules SDK": New. I Chose the folder containing the whole Android SDK and chose the last Android (e.g. 6.0) with the last Module SDK 23.0.

Either revert to appcompact-v22 or update to android api v23

You have to update your SDK to the API 23 that is either not downloaded or not installed properly.
Make sure your compileSdkVersion and dependencies version should be same.

I was having problem with new appcompat V-23 as my target sdk is 21. So I did following two steps and it works perfectly for me..
1) Delete the values-23 folder in res folder.
2) I was getting error on the src folder as well, so commented the only line inside main() of snippet.java as we do not require it.
Then add this project as library to your project.. Hope it helps.

I resolved like below
android {
compileSdkVersion "Google Inc.:Google APIs:21"
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
}
replaced the above dependencies with below...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:7.8.0'
}

To correct this error in android studio procceded like this :
i went to sdk manager and i downloaded and updated all packages of android api 23
file => project structure and i changed compile sdk version from 21 to 23 and build tools version from 21 to 23

The problem generally occurs due to version issues. The following dependencies and compilesdkversion Worked for me:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:support-v13:23.0.+'
compile 'com.firebase:firebase-client-android:2.2.4+'
}

The answer #31 & #11 in this discussion can solve this issue:
https://code.google.com/p/android/issues/detail?id=183122

My issue was, one of my un-used dependencies was using sdk-23 version. So after removing those un-used dependencies it worked like a charm.

Related

Android Studio Build.Gradle Sync Error

I am experiencing a problem building my application in Android Studio. I am using Android Studio 2.2 Preview 7. When I start up my Android Studio it gives an error:
The plugin is too old, please update to a more recent version, or set
ANDROID_DAILY_OVERRIDE environment variable to xxxxxxx.
It requests I fix plugin version and sync project. I have made all the required updates but the error remains. I have read similar questions on the issue but they don't seem to apply to my case.
Could you please assist in providing me with a working solution?
Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.mobileappdev.novarttech.sunshine"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
compile 'com.android.support:design:23.3.0'
testCompile 'junit:junit:4.12'
}
As per my observation it seems like you haven't updated Android SDK platform to version 25. First of all download and install android sdk platform and build tools from SDK Manager and use the following lines in your build.gradle(module app)
compileSdkVersion 25
buildToolsVersion "25.0.0"
Also update dependencies according to that. It should work then
As #claudio-redi says, you need to upgrade your build gradle tools.
Use build tools 2.2.2 to your root build.gradle:
classpath 'com.android.tools.build:gradle:2.2.2'
And change the gradle distribution to 2.14.1 in gradle/wrapper/gradle-wrapper.properties file with:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Or if you already have download the gradle distribution and place it in a directory, you can set it in your Android Studio from menu File->Setting->Gradle and set it as the following image:
Please be noted when you want to use API Level 25 you need to make sure that compileSdkVersion, buildToolsVersion, targetSdkVersion, and Support Library using the same API Level 25.

how to use marshmallow in Android studio

I am using Android studio and i want to use Marshmallow API and AppCompatActivity. When I created a new project the build.gradle contained the below lines but I receive error at R class which says not a symbol.
Please let me know how to correct the build.gradle to get the App work.
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.com.myapplication"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
Click on Build->Clean Project and that will perform a gradle clean
Update your Android SDK Manager Install all component of Android 6.0 (API 23)
R file can be erased due to many reasons, try rebuilding your project(which is the most common issue) and other issues may include any syntax error or inappropriate file permissions in work space, the exact error report can help address the issue better.

Failed to find: com.android.support:support-v4:22.2.0

I am trying to do an application but there seems to be some error with the gradle files now. It was working fine until I upgraded the support libraries.
I was working with api 21 which worked fine, but then i upgraded to api22 and changed the gradle files accordingly.. Now this error shows up.
Error:Failed to find: com.android.support:support-v4:22.2.0
This is my current gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.sampleapp"
minSdkVersion 12
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.jakewharton:butterknife:6.1.0'
}
Any help would be appreciated.
If this might help someone, after MANY trials and errors, I found that I was targeting the wrong SDK version (an older one) in the build.gradle file corresponding to "library". To change this you can do it by hand or go to the Module Settings Menu (right click on your project folder -> Open Module Settings. Then in "library" - Properties you can change the Compile Sdk and the Build Tools Versions
Using Android SDK Manager. Go to Extras and then Android Support Repository and update it to the latest version.
(This is essentially the comment #natario made, but it should be an answer.)

Android missing layout_alignParentStart after upgrade

I upgraded from Android Studio 0.5 to 0.8
now I have heaps of issues, I resolved most of them but now I get this error
Error:(12) No resource identifier found for attribute 'layout_alignParentStart' in package 'android'
I dont know why it does not have layout_alignParentStart anymore?!
am I missing something here?
I had the same issue, my problem was the compileSdkVersion, I changed from 16 to 20 and it works.
I give you my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "mypackage"
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.+'
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:20.+'
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v13:20.+'
}
Since API level 17, android has some new attributes for RTL layout such as:
layout_alignParentStart
layout_alignParentEnd
layout_alignStart
layout_alignEnd
layout_marginStart
layout_marginEnd
however some devices has special ROM which may not support these attributes and leads exception
Remove all these *Start /*End attributes can fix the issue

Failure [INSTALL_FAILED_OLDER_SDK] in Android Studio

So I know that many other people had this problem, but mine is a little different. I've tried running my app on an LG G2 with Android 4.4.4, and a Note 3 with Android 4.4.2, but neither worked. I have installed the API 18, 19, and 20 SDKs.
Failure [INSTALL_FAILED_OLDER_SDK]
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ween.control"
minSdkVersion 8
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
}
You can't test an Android-L app on a device with lower API.
Take a look here.
You need to make sure your dependencies are configured targeting the same sdk (also make sure the sdk is supported for the dependency).
As of version .11, the gradle plugin now uses the new manifest merger tool by default which you can use to avoid conflicting configurations when merging manifests from your dependencies while building by specifying <uses-sdk tools:node="replace" /> in your AndroidManifest.xml file.
http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger
credit goes to Eddie Ringle
I was having a similar issue but my device sdk was 19 and it was looking for it to be 20. I changed the sdk from the file > Project Structure > SDK to 19 also I noticed when I was running it had the wear value selected in the top toolbar so I switched that to mobile and Voila.

Categories

Resources