282

I'm using Android Studio and when I add compile "com.android.support:appcompat-v7:21.0.0" to my Gradle file, I'm getting a ton of errors:

C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v11\values.xml
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v14\values.xml
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v21\values.xml
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.ActionBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark.ActionBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Light'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(298, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(298, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Dialog'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.Dialog'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(144, 21) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(146, 21) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(147, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(145, 21) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(142, 21) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(143, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'.

All of these seem to be showing up in:

\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v11\values.xml

and

\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v21\values.xml
JasonMArcher
  • 12,386
  • 20
  • 54
  • 51
Michael Garber
  • 2,876
  • 2
  • 9
  • 14

22 Answers22

427

AppCompat v21 builds themes that require the new APIs provided in API 21 (Android 5.0). To compile your application with AppCompat, you must also compile against API 21. The recommended setup for compiling/building with API 21 is a compileSdkVersion of 21 and a buildToolsVersion of 21.0.1 (which is the highest at this time - you always want to use the latest build tools).

ianhanniballake
  • 155,909
  • 19
  • 351
  • 362
  • 6
    But wont doing this make my app incompatible with older versions? I'm wanting my app to date back to sdk 15 – Michael Garber Oct 20 '14 at 01:01
  • 45
    `compileSdkVersion` is completely different from `minSdkVersion` (which controls the lowest level you say your application can run on) and `targetSdkVersion` (which controls any automatically applied backward compatibility features - important if you haven't tested your application on the newest API as of yet). – ianhanniballake Oct 20 '14 at 01:02
  • im not seeing the minSdkVersion and targetSdkVersion specifications in the gradle build file, where can these be found and set? Edit: nevermind, wasn't paying attention – Michael Garber Oct 20 '14 at 01:03
  • This seems to have worked as gradle is not building my app, Much thanks. – Michael Garber Oct 20 '14 at 01:04
  • 18
    Any advice if you've already got this, but are still getting the error? I've got `compileSdkVersion` of 21 and `buildToolsVersion` of `21.0.1` but no luck. – Tom Oct 20 '14 at 03:01
  • 7
    @engico Unfortunately, that hasn't done it for me. I'm now on `21.0.2` and still no luck. – Tom Oct 24 '14 at 15:29
  • I am on Eclipse and it worked for me. You might have missed some step. I followed this [link](https://developer.android.com/tools/support-library/setup.html). – engico Oct 24 '14 at 17:14
  • @Tom I found that problem was in other library that I used (in my case it was betterpickers). Try disabling libraries one by one to find the one that conflicts. – Sver Oct 31 '14 at 09:50
  • 2
    Thanks @Sver, unfortunately I've removed ALL libraries and no prevail. Only @shider's solution of changing to `appcompat-v7:20.0.0` works, but that version doesn't have all the features I'm looking for so it's pointless. I've also confirmed this happens on a blank project, brand new with `appcompat-v7:21.0.0` using the new Build Tools `21`. – Tom Nov 01 '14 at 23:25
  • Will app continue working on devices having older SDKs than v21? @ianhanniballake – AVEbrahimi Jan 23 '15 at 07:34
  • 2
    @AVEbrahimi - as per my previous comment on this answer, yes: AppCompat works down to API 7 devices. `compileSdkVersion` does nothing to affect compatibility. – ianhanniballake Jan 23 '15 at 14:51
  • @ianhanniballake can u pls help me i m using eclipse and updated my sdk to 5.0 now getting errors in all projects and unable to run even i import latest appcompat_v7 from extras directory but still not luck – Erum Jan 26 '15 at 19:15
  • If this helps anyone, I did try to compile at 21.0.0, 21.0.2, and 21.0.3, and for some reason the 1st and 3rd ones work, but 21.0.2 gives lots of errors, saying some `appcompat` files are missing, etc. But the 1st and 3rd ones worked! Since you basically just need it to be 21. – Azurespot Feb 11 '15 at 02:05
  • 1
    Don't forget to use and set your JDK to 1.7. These latest APIs use JAVA 7. – Franklin Hirata Feb 11 '15 at 18:13
  • 1
    To change min `minSdkVersion` of android studio project http://stackoverflow.com/questions/19465049/changing-api-level-android-studio – Chaki_Black Feb 15 '15 at 07:10
  • @ianhanniballake Cannot resolve symbol 'android:Theme.Material.Light' in in valules-v21 – Pankaj Nimgade Mar 05 '15 at 10:17
  • 1
    Only modifying `buildToolsVersion` to `22.0.1` did not worked. I had to modify my `[android-sdk-dir]/extras/android/support/v7/appcompat/project.properties` file. Simply changing `target=android-19` to `target=android-21`. Now it is working. – tato.rodrigo Jun 10 '15 at 17:05
  • perfect. Thanks much. – Bishal Paudel Jul 17 '15 at 15:56
  • @ianhanniballake - thanks for the clarification on compile v targeted. I feel saner. error cleared. you rock. – Joe Healy Aug 26 '15 at 19:09
  • In my case it turned out that one of the libraryie I was pulling in on the app gradle.build dependencies was pulling in the higher App Compat. When I removed that, things worked ok with sdk 19 -- which is what I needed. – steven smith Dec 25 '16 at 21:52
  • 1
    @stevensmith - well, right up until they call something that doesn't exist in the v19 version and your app crashes. You should upgrade. – ianhanniballake Dec 25 '16 at 22:12
  • @ianhanniballake um -- my phone doesn't support before 19 :) – steven smith Dec 26 '16 at 21:01
  • 1
    @stevensmith - you misunderstand. If a library you are using uses a method introduced in say the v23 version of the Support Library, you cannot use the v19 version of AppCompat. Sure, maybe you will get lucky, but maybe you won't. – ianhanniballake Dec 26 '16 at 21:11
43

Make sure the value for target (which tells the target android version) in project.properties file of both your project folder and appcompat_v7 folder is same (preferably the latest).

: inside 'your_project'/project.properties

target=android-21 android.library.reference.1=../appcompat_v7

and

: inside appcompat_v7/project.properties

target=android-21 android.library=true

and after this don't forget to clean your project .

GiriB
  • 1,044
  • 1
  • 10
  • 24
18

Changing compile 'com.android.support:appcompat-v7:21.0.0' into compile 'com.android.support:appcompat-v7:20.0.0' in gradle.build works for me.

shider
  • 197
  • 2
12

If you are using android studio goto File --> Project Structure In the Properties tab change Compile Sdk Version to AP1 21 and Build Tools Version to highest available version. And then Refresh Gradle

Shabbir Ahmad
  • 199
  • 1
  • 7
7

changing the complie SDk version to API level 21 fixed it for me. then i ran into others issues of deploying the app to my device. i changed the minimun API level to target to what i want and that fixed it.

incase someone is experiencing this again.

megaKertz
  • 416
  • 4
  • 11
4

Just select target api level to 21 for compiling, click Apply -> click OK, clean and build project and run it.

Screenshot for same

Hiren Patel
  • 48,538
  • 20
  • 161
  • 144
4

my solucion is compile with other version

build.gradle (app)

compileSdkVersion 21

Good Luck

David Hackro
  • 3,276
  • 5
  • 35
  • 56
4

Change your compile sdk to 23.This fixed it for me.

faro_hf
  • 99
  • 1
  • 2
3

I vote whoever can solve like me. I had this same problem as u , I spent many hours to get correct . Please test .

Upgrade entire SDK , the update 21.0.2 build also has updates from Google Services play . Upgrade everything. In your workspace delete folders ( android -support- v7 - AppCompat ) and ( google -play - services_lib )

Re-import these projects into the IDE and select to copy them to your workspace again.

The project ( google -play - services_lib ) to perform the action of Refresh and Build

**** ***** Problem The project ( android -support- v7 - AppCompat ) mark the 5.0 API then Refresh and Build .

In his project , in properties , android , import libraries ( android -support- v7 - AppCompat ) and ( google -play - services_lib ) then Refresh and Build .

Dexter
  • 546
  • 4
  • 10
3

If you don't want to use API 21 you can use the older version of appcompact library, use older app compact library without updating it.

you can achieve this by simply following steps:

1) Extract the downloaded version of complete sdk and eclipse bundle.

2) Simply import appCompact library from sdk\extras\android\support\v7\appcompact

now you are done.

DjP
  • 3,957
  • 2
  • 21
  • 30
2

I have updated the build.gradle(Module: app): Old Code:

  compile 'com.android.support:appcompat-v7:23.0.1'

New Code:

 compile 'com.android.support:appcompat-v7:22.2.0'

Works for me in android studio.

Mukul Aggarwal
  • 1,295
  • 16
  • 13
1

Resource for android will be a option available when you go to your sdk manager and select Android 5.0. Download and install that. This will fix the problem of resource not found.

Kaushik
  • 6,017
  • 5
  • 33
  • 51
1

Hi there I was having the same error involving the appcompatv7 library and I did as @ianhanniballake suggested and check the build version of the library, by selecting it and giving a click with the secondary button of the mouse then:

Properties -> Android -> Android 5.0.1 api level 21

then clean all projects but I had no luck, so after loosing all my hopes I decided to upgrade from Eclipse Kepler to Eclipse Luna.

While I was waiting for the download to complete. I decided to try another thing, so I went and delete from eclipse the appcompatv7 library and checked the

Delete project contents on disk.

Opened the Android SDK to check if there were any updates, then I removed all library references from my project by selecting my project and under

Project -> Properties -> Android -> Library section

removed all libraries including the one that started all this problem

Google_Play_Services_Lib

then restarted Eclipse and copied from the Android SDK.The folder appcompat from:

android-sdk-linux/extras/android/support/v7

To my eclpse workspace, then imported it agan in to Eclipse from Import exsting project in workspace then choose the propper build tool version

Android 5.0.1 api 21

and added all my reference libraries, cleaned all projects and done everything was working again.

I choose for all my reference libraries the same build tool.

Hope this helps!!!!

By the way I tried to give a vote but I haven't had enough rep to do it.

Drisvalakas
  • 139
  • 1
  • 3
1

Check adding google play services here as i was facing the same problem and removed everything then followed the steps and got everything working.

nahlamortada
  • 479
  • 6
  • 15
1

I ran into the same issue and had the right API level values in my build.gradle compileSdkVersion 21, targetSdkVersion 21 and a buildToolsVersion of 21.0.1

However, I was including this as a module in my project so I had to make sure the other module gradle settings matched API 21. After that it all worked for me.

velval
  • 2,459
  • 27
  • 38
1

I changed

compile 'com.android.support:appcompat-v7:19.1.+'

into

compile 'com.android.support:appcompat-v7:22.1.+'

in build.gradle and after sync I didn't get any errors

1

In my case with Eclipse IDE, I had the same problem and the solution was:
1- Install the latest available API (SDK Platform & Google APIs)
2- Create the project with the following settings:

  • Compile With: use the latest API version available at the time
  • the other values can receive values according at your requirements (look at the meaning of each one in previous comments)
Daynel
  • 58
  • 1
  • 1
  • 7
1

For me works this:

android {
compileSdkVersion 21
buildToolsVersion '23.0'

defaultConfig {
    applicationId "nl.changer.polypickerdemo"
    minSdkVersion 15
    targetSdkVersion 21
---------
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'


}

I modified: compileSdkVersion 21 buildToolsVersion '23.0' appcompat-v7:22.2.0'

Alexiscanny
  • 573
  • 7
  • 15
1

I was facing this problem when I imported google-services.json file to implement Analytics. I already had global_tracker.xml file in the xml folder. During build, while merging contents from google-services.json file, the error was started occurring. For time being, the error is resolved after removing the goolgle-services.json file. And using the older Analytics solution.

Check the last XML or Json file that you edited/imported and maybe you will file error there. That's what helped in my case.

Lalit Rane
  • 648
  • 8
  • 14
1

THIS HELPED ME

  • Update the Android SDK to latest version
  • Update app/build.gradle with latest components:

    compileSdkVersion 25  
    buildToolsVersion "25.0.2"  
    minSdkVersion 17  
    targetSdkVersion 25
    

Hope this solves your problem

Prashanth
  • 317
  • 3
  • 17
1

This works very well for me. Go to the android-support-v7-appcompat project and open the file "project.properties" and insert this lines if missing:

target=android-25
compile=android-21
technik
  • 711
  • 7
  • 15
1

I was facing the same issue for one of my phonegap project. To resolve this I have followed , following step

1) Right click on Project name (In my Case android) , select "Open Module Settings"

2) Select modules (android and CordovaLib)

3) Click properties on top

4) Chose Compile SDK version (I have chosen API 26: Android 8.0 )

5) Choose Build Tools Version (I have chosen 26.0.2)

6) Source Compatibility ( 1.6)

7) Target Compatibility ( 1.6)

Click Ok and rebuild project.

Also one more additional step

Add

compile 'com.android.support:appcompat-v7:27.0.2'

build.gradle (Module:android)

Following link shows my setting for step I have followed

https://app.box.com/s/itkkjz09wgy36jwowhvzcyx6fp7o2gkh

Chirag Purohit
  • 671
  • 11
  • 18