14

I get this error when trying to use latest Google Play Services SDK:

C:\Program Files (x86)\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values-v21\appinvite_styles.xml:5: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.

I am targetting android-19 but have also tried android-21 with same result. I have the Android Support Library enter image description here

If I use older version of Google Play Services (rev. 21), the error is not there. Also there is no folder values-v21 in the earlier version. How to fix this error?

EDIT: I have tried using API 21 but this error persists. in manifest.xml:

<uses-sdk android:minSdkVersion="21"        
      android:targetSdkVersion="21" />

in project.properties:

target=android-21
morpheus
  • 18,676
  • 24
  • 96
  • 159
  • 3
    Set your `compileSdkVersion` to 21 or higher. And, since I am guessing that you're still using Eclipse (despite the fact that official support for it ends in ~2 weeks), `compileSdkVersion` equates to your build target (Project > Properties > Android). That theme was added [in API Level 21](http://developer.android.com/reference/android/R.style.html#Theme_Material_Light_DialogWhenLarge_NoActionBar). – CommonsWare Dec 19 '15 at 22:33
  • also I always worry about folders with spaces in (**been bitten in the past**) I would move your Android SDK out of **C:\Program Files (x86)\Android\** and into **C:\Android\** just to save yourself worrying – Blundell Dec 19 '15 at 22:37
  • I have done both these things and the problem persists – morpheus Dec 19 '15 at 22:41
  • looks like compileSdkVersion is a gradle thing? I am using ant build and compileSdkVerion does not exist in the uses-sdk element http://developer.android.com/guide/topics/manifest/uses-sdk-element.html – morpheus Dec 19 '15 at 22:49
  • 1
    Move to Android Studio and your problems (just like this) will end :-) – RafaelJan Dec 19 '15 at 22:57
  • @rafraph - Last time I used an IDEA-based IDE it ended up using 800MB of RAM while sitting around doing nothing. I only have 4GB on my system, so can't really afford to waste that much. Have they improved it any? – Jules Sep 27 '16 at 16:47

3 Answers3

22

Follow these steps

  • Right click, Properties of google-play-services_lib project
  • goto java compiler and set it to 1.5
  • goto android and set project build target to android 6.0
  • make sure you installed latest update for android sdk tools and google play services in your sdk

Close the project and Open it, this helps too.

Nouman Tahir
  • 819
  • 1
  • 9
  • 26
Sharad Kesari
  • 221
  • 1
  • 2
  • 1
    For me, I only had to change my project to use "android 6.0" .. didn't have to change the JDK for `google-play-services_lib`.. and it did the trick. Thanks! – Gene Bo Apr 26 '16 at 02:58
  • With all due respect this is an absurd suggestion, and it does not work for me. – Andrew S May 19 '16 at 18:56
  • @AndrewS I don't see why you'd think it's absurd. The problem seems to be that when you import the project in Eclipse it picks incorrect default settings for these properties. The project must be compiled with Java 1.5 as it is required to support older versions of Android for which that is the latest acceptable version, and it needs the build target to be high enough for the symbols requested to exist; for some reason Eclipse had picked Java 1.6 and Android 4.4.2 for me. Changing it to 1.5 and 5.0.1 worked fine. – Jules Sep 27 '16 at 16:53
4

I fixed it by changing the minSdkVersion in google-play-services_lib manifest to the minimum SDK version used by my app. Example: <uses-sdk android:minSdkVersion="14"/>

Aspiring Dev
  • 505
  • 1
  • 4
  • 17
0

I don't use any IDEs. The way I fixed it was to upgrade to gradle and set compileSdkVersion to 23 or another option was to stick with ant and the old version of Google Play Services (rev. 21) which luckily I had checked into my repo. (the SDK manager will always give you latest version which is 29 at time of this writing).

morpheus
  • 18,676
  • 24
  • 96
  • 159
  • to download old versions of google play service go to this link : http://stackoverflow.com/questions/20982533/how-to-download-older-google-play-services – Arash Feb 27 '16 at 09:55