101

After a recent update to Android Studio, we're having problems getting a project to compile that previously worked. At first we were getting the following error:

/Users/james/Development/AndroidProjects/myapp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/res/values-v23/values-v23.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

I updated the sdk build target in our gradle file to 23, which made this specific issue go away, but it left us with a ton of apache.http package errors (specifically, a ton of apache packages we use for http stuff are now gone in sdk 23).

What I want to do is solve the strange resource error, but without updating to sdk 23. I don't have the time to re-write our tools library right now to use whatever new implementation of apache http components has been issued. Does anyone have any ideas?

James Dobson
  • 1,191
  • 2
  • 8
  • 14
  • Don't you get the error in the appcompat_v7 res/values-v23/styles.xml itself (rather than in your project)? – Solace Aug 23 '15 at 08:43
  • 1
    Not sure I understand your question? We were getting the issue in a generated file as indicated by the file path in the error posted above. – James Dobson Aug 25 '15 at 11:04
  • If the error is occurring in the generated files, then you have to update the the build tools, in gradle, to match the libraries version. i.e. buildToolsVersion "23.0.1" – BK Batchelor Oct 06 '15 at 14:50

14 Answers14

197

You need to set compileSdkVersion to 23.

Since API 23 Android removed the deprecated Apache Http packages, so if you use them for server requests, you'll need to add useLibrary 'org.apache.http.legacy' to build.gradle as stated in this link:

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"
    ...

    //only if you use Apache packages
    useLibrary 'org.apache.http.legacy'
}
Roberto B.
  • 3,065
  • 2
  • 18
  • 11
  • 1
    This will work but you will want to make sure to install the new SDK Version. API 23 (Android 6.0 Platform). This will allow you to support newer devices. That is why when you change the "appcompat version" to a newer version it will require the newer SDK version. – JamesDeHart Aug 20 '15 at 10:43
  • 4
    This answer is much better than to go back to 22.2.1 – Jörn Buitink Aug 21 '15 at 14:22
  • 4
    It is certainly an ideal answer and is obviously the correct course of action for most people, however, it does not answer my question which was to solve the issue without updating the sdk version. Doing so breaks a library we depend on but didn't have time to update at the time. We've since updated the library to make use of the new features and we can now safely update to sdk 23. – James Dobson Aug 25 '15 at 11:03
  • @RobertoB. Thanks, thats good info. We've already updated our codebase to use the new apache libraries, but hopefully it will help others! – James Dobson Aug 25 '15 at 13:28
  • How is this related to the error messages the OP reports? I think compileSdkVersion is a valid workaround, but using the legacy apache library is just an indirect requirement. – mdelolmo Sep 07 '15 at 12:44
  • This was useful. I got an error under **gradle verion 1.1.1** since it doesnt support the `**usesLibrary**` declaration. Please include the relevant `classpath 'com.android.tools.build:gradle:1.1.1'` line for completeness. – nyxee Sep 12 '15 at 22:50
  • @RobertoB., After making following configs: compileSdkVersion 23 buildToolsVersion "23.0.0" and supprtVersion in appcompat to 23.0.0 I am getting this issue Error:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (22.2.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details. Can you please help in this – Ashok Singhal Apr 20 '16 at 07:58
78

Change the appcompat version in your build.gradle file back to 22.2.1 (or whatever you were using before).

Tunga
  • 1,014
  • 9
  • 10
  • 5
    Thanks, this was the solution. I followed the instructions here: https://code.google.com/p/android/issues/detail?id=183122#makechanges specifically, the solution offered by scott. I had to delete the 23.0.0 in my sdk folder, delete the version 23 sdk in the SDK manager and then do a clean & rebuild – James Dobson Aug 19 '15 at 10:27
  • 4
    James, thanks for the solution. However, I am just bloody astounded at this PITA situation - because I never had appcompat-v7:22.2.1 installed !! – Someone Somewhere Aug 20 '15 at 05:07
  • Is there a way to do that in Eclipse? – Solace Aug 23 '15 at 07:40
  • 10
    @Solace Eclipse is useless – Fayçal Aug 23 '15 at 09:05
  • @BackPacker Try but my computer is too slow to support AS. I tried it, and when I start it, everything starts hanging. – Solace Aug 23 '15 at 11:12
  • 6
    @BackPacker No. Android Studio is the problem. I have a good computer and Android Studio takes forever to compile a simple hello world app. – TheRealChx101 Sep 21 '15 at 23:33
  • For those who keep downvoting this, please leave a comment explaining why. Note that the question says "What I want to do is solve the strange resource error, but without updating to sdk 23." This is the answer to that precise question. It intentionally does not deal with the larger issue of whether remaining on an old SDK is good or recommended because that is not what was asked. – Tunga Dec 31 '15 at 15:06
  • Just because someone asked the wrong question, doesn't make this the right answer. See answer from @roberto-b below – Bron Davies Jan 14 '16 at 16:18
21

in your projects build.gradle file... write as below.. i have solved that error by change the appcompat version from v7.23.0.0 to v7.22.2.1..

dependencies

{

compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'

}

Below screen shot is for better understanding.

urnish
  • 449
  • 3
  • 9
  • 1
    No NO No....I wasn't expecting this! BUT THIS WORKED!! What's the point in updating it to 23.0.1 then? – sud007 Sep 21 '15 at 11:07
  • This one gets my +1: it's not always appropriate to just update to the latest version of everything immediately someone tells you to. This one answers the original question, and fixes the problem for me. – Mark Smith Sep 29 '15 at 13:44
10

Attention, wrong answer coming! But anyone without apache libraries or so might find

compileSdkVersion 23
buildToolsVersion "23.0.0"



//...


dependencies {
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'    

}

helpful, it did the trick for me.

4

you should change your compiledsdkversion and targetversion to 23 in the build gradle file specific to the app.Make sure you installed sdk 23, version 6.0 before this.You can watch this vid for more help.https://www.youtube.com/watch?v=pw4jKsOU7go

Dinesh Sunny
  • 4,663
  • 3
  • 30
  • 29
2

if u are getting errors even after downloading newest SDK and Android Studio I am a newbie: What i did was 1. Download the recent SDK (i was ) 2.Open file-Project structure (ctrl+alt+shift+S) 3. In modules select app 4.In properties tab..change compile sdk version to api 23 Android 6.0 marshmallow(latest)

make sure compile adk versionand buildtools are of same version(23)

Hope it helps someone so that he wont suffer like i did for these couple of days.

xsushil
  • 37
  • 1
2

Try to match all version:

compileSdkVersion 23
buildToolsVersion '23.0.0'
targetSdkVersion 23
compile 'com.android.support:appcompat-v7:23.0.0'

It's work for me.

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

compileSDK should match appCompat version. TargetSDK can still be 22 (e.g. in case you didn't update to the new permission model yet)

cwiesner
  • 934
  • 1
  • 8
  • 24
1

if you have :

/Users/james/Development/AndroidProjects/myapp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/res/values-v23/values-v23.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

error , you must change your appcompat , buildtools , sdk to 23 but , if you don't like to change it and must be in 22 do this :

  • compile 23
  • target 22
Adnan Abdollah Zaki
  • 4,328
  • 6
  • 52
  • 58
0

It's works just when the build.grade was changed to that:

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "blablabla"
        minSdkVersion 15
        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.0.0'
}
0

I noticed I didn't have sdk 23 installed. So I first installed it then re-built my project. And it worked fine. Also compilesdkVersion should be 23

0

First of all,

Try to check your SDK folder, for me, it was mydocuments/appdata/sdk.... etc. So basically my sdk folder was not fully downloaded, the source of this problem mainly. You have to either use another fully downloaded android sdk(including Tools section and extras that you really need) or use the eclipse sdk that you may downloaded earlier for your Eclipse android developments. Then build->clean your project once again.

Worth to try.

Adnan Bal
  • 213
  • 3
  • 16
0

Upgrade to use API 23 (Android 6.0) or change back the appcompat-v7 to 22.2.2 version in Gradle. This work for me when add google play service

Leo
  • 1
0

Method 1: It is showing.you did not install Api 23. So please install API 23.

Method 2:

Change the appcompat version in your build.gradle file back to 22.0.1 (or less).