3

I'm using Android Studio IDE and i keep getting this error after adding the google play services library. Keep in mind this is using a project that is Eclipse based and we don't have any gradle files.

No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')

First let me say how I added the library…

I located my android SDK folder, then find the google-play-services-jar and then i just copied it to my /libs folder. Then I went under...

File > Project Structure > Libraries > + added the google-play-services.jar

Now its listed under this, but I keep getting the above error in my manifest on line…

<meta-data android:name="com.google.android.gms.version"
           android:value="@integer/google_play_services_version"/>

I've tried searching high and low on what to do, but nothing is working for me. Also when I go under File > Project Structure > Modules > + Module Dependency it just says there is none.

Sky Kelsey
  • 19,192
  • 5
  • 36
  • 77
eqiz
  • 1,521
  • 5
  • 29
  • 51
  • In Android Studio, you can check in **app/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/$rootProject.ext.playServicesVersion/res/values/values.xml** to see if that integer was generated by your gradle build. – IgorGanapolsky Dec 20 '16 at 17:57

1 Answers1

4

The Play Services SDK is an Android library project, not a JAR, which is why the version resource is not available to you. Undo all the stuff you did above, then add the following line to the dependencies closure in your module's build.gradle file (e.g., app/build.gradle):

compile 'com.google.android.gms:play-services:7.0.0'

Or, for a faster build and smaller APK, choose more focused dependencies, for whatever bit(s) of the Play Services SDK that you need.

You can read more about this process in the documentation.


UPDATE

Apparently, somehow, this project is using the IntelliJ IDEA build system directly, which means that you will have to follow other advice for getting the Play Services SDK into IDEA. That being said, I would really recommend moving over to Gradle, as I would not count on necessarily being able to use the IDEA build system in Android Studio directly over the long haul.

Community
  • 1
  • 1
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I understand the first part, but as i mentioned this is not a GRADLE project. So i have no build.gradle at all. Can you please describe how to do what you just mentioned using an ECLIPSE project thats loaded into Android Studio with absolutely no gradle? – eqiz Apr 10 '15 at 17:28
  • @eqiz: "using an ECLIPSE project thats loaded into Android Studio with absolutely no gradle?" -- then wha are you using for a build system. Android Studio uses Gradle by default, even for imported Eclipse projects. If you have manually configured Android Studio to use some other build system (e.g., Maven), you would need to find out the right recipe for that build system. If you have not manually specified anything, look in your project directories, and you will find Gradle build files. Note that if you imported the project, these files would be in the copy that Android Studio made. – CommonsWare Apr 10 '15 at 17:38
  • How would I find out the build system? I know what grade files your talking about, they would be located in the base directory. But they don't exist. – eqiz Apr 10 '15 at 17:41
  • @eqiz: "How would I find out the build system?" -- if you did not somehow specify otherwise, it is Gradle. "But they don't exist" -- then Android Studio apparently is not building your project. I don't know how you got the project into Android Studio without those files. So, go add them. – CommonsWare Apr 10 '15 at 17:44
  • Error:(29, -1) android-apt-compiler: [Project] C:\Users\Donald\Android StudioProjects\ProjectFinal\Project\AndroidManifest.xml:29: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version'). Whats building it then? – eqiz Apr 10 '15 at 17:45
  • 1
    @eqiz: I'm not sure. A search on `android-apt-compiler` suggests that perhaps it is IDEA's own build system (Studio being based off of IntelliJ IDEA). I have no idea if IDEA's build system supports Android library projects or AAR artifacts from an artifact repository. I also wasn't aware that Android Studio could use IDEA's build system directly without involving generating the metadata (e.g., `.iml` file, `.idea/` directory) from Gradle build files. You're sure that you're using Android Studio, and not regular IntelliJ IDEA? – CommonsWare Apr 10 '15 at 17:48
  • I am 100% sure i'm using Android Studio. I created this project a long time ago and been working on same structure ever since, it must still be using the IntelliJ IDEA base system but still running somehow... However you helped me tremendiously and gave me the answer i needed! I was able to find my resolution following your advise to look for that compiler and looked at: http://stackoverflow.com/questions/17960315/importing-google-play-services-lib-into-intellij-idea-12-and-13 and now it works. Please link this in your answer i'll marked your response as answered! – eqiz Apr 10 '15 at 17:58