Reputation: 1507
I dont know much about this appcompat library so apologies if this isnt the smartest question.
I have a project that i was having a problem with. Turns out i had the targetSdkVersion set to 23 and it was causing me a problem since i wanted to use 21. So I changed it to 21.
In my build.gradle I have compile com.android.support:appcompat-v7:23.1.1.
And this causes the following problems when i try to build:
C:\Users\Conor\Documents\Programming\AndroidStudioProjects\AndroidStudioProjects\RouteTracker\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\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:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Conor\AppData\Local\Android\sdk\build-tools\21.0.0\aapt.exe'' finished with non-zero exit
So I tried to use appcompat of com.android.support:appcompat-v7:21.1.0 (as it was the only one i could definitively find), but it didnt work either. Says it couldnt find it and tells me to use the latest version, which is 23.1.1.
So should I be using 23.1.1? If so, any ideas what these errors are about?
Upvotes: 1
Views: 2416
Reputation: 786
You have got your solution but the answer to your questions 'Can I use the latest version of the appcompat library with a project that is targeting sdk 21' is as follows. Project lib should be compatible with 'compileSdkVersion' & not necessarily with targetSdkVersion. Ideally your compileSdkVersion & targetSdkVersion would be same but if your requirement is to target lower targetSdkVersion then you can keep it lower than compileSdkVersion.
Upvotes: 0
Reputation: 364566
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
It happens because you are using the support libraries v23 which require to compile with API 23.
Change in your build.gradle
this line:
compileSdkVersion 23
You can use another version of the support library but:
Here the full list:
//it requires compileSdkVersion 23
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.0'
//it requires compileSdkVersion 22
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:appcompat-v7:22.0.0'
//it requires compileSdkVersion 21
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.0'
Upvotes: 3
Reputation: 2693
No. AppCompat latest update remove some old dependencies. This is only available with v23. So, You have to update your code with targetSdkVersion 23.(marshmallow).
Upvotes: 0