Reputation: 6832
When upgrading my project to the latest version of Google Play Services (v4.0, released on Halloween 2013), you are now supposed to add a new tag into the AndroidManifest.xml
file.
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Unfortunately, when I try doing that, I then get this compile error:
android-apt-compiler: /blahblah/AndroidManifest.xml:409: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
I can then navigate to the file at google-play-services_lib/res/values/version.xml
and view the raw integer for that symbol:
<integer name="google_play_services_version">4030500</integer>
And then insert it back into my AndroidManifest.xml
:
<meta-data
android:name="com.google.android.gms.version"
android:value="4030500" />
Doing this works absolutely fine and I can then compile and run the project and app just fine. But it's definitely an undesirable fix with obvious upgradability issues.
Any ideas?
Upvotes: 185
Views: 220069
Reputation: 51
I had the same problem, add this 2 line in your build.gradle the problem will be resolved probably. ;)
dependencies {
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-vision:10.0.0'
}
Upvotes: 0
Reputation: 3763
Android Studio 3.3.2 under Windows 10
File -> Invalidate Caches/Restart
and choose invalidate and Restart
button in the dialog appeared.
Upvotes: 1
Reputation: 4473
For everyone using Eclipse, this is how you should do it.
Eclipse -> import -> existing android code -> browse -> navigate to google-play-services_lib FOLDER (android-sdk/extras/google/google_play_services/libproject).
Then, on your project
control click -> properties -> android -> libraries, add -> select the project you just imported -> ok
Upvotes: 256
Reputation: 340
Anybody looking in 2017, the 10.0.1 version of play services requires importing play-services-basement
(use to be in play-services-base
).
Upvotes: 0
Reputation: 127
Fixed by adding Google Play Services to my Module:app gradle build file. Documentation also says to update version when you update GMS.
dependencies {
compile 'com.google.android.gms:play-services:9.6.1'
}
Upvotes: 2
Reputation: 8263
When not using an IDE, but using command line builds (using ant and ndk-build), this is how to solve it:
Install all the req'd parts with 'android' command. Then have a copy of google-play-service_lib/ in your project root. Edit project.properties to include this line:
android.library.reference.1=./google-play-services_lib
Upvotes: 1
Reputation: 5381
In my case, I needed to copy the google-play-services_lib FOLDER in the same DRIVE of the source codes of my apps
Upvotes: 1
Reputation: 126445
if you don´t have the library into your workspace in Eclipse you can add it with:
File
-> Import
-> Existing Android Code Into Workspace
-> browse and navigate to google-play-services_lib
project lib, (android-sdk/extras/google/google_play_services/libproject
).
/bin
and /gen
folders of my project (something similar to the clean option) and building my project again.Upvotes: 7
Reputation: 1252
Google suggests you don't create a project directly from the SDK directory. It's better to copy the lib project out to the location where your app is, then import it from there. Otherwise the next time you go to import the project for another app, it will already be in use.
https://developer.android.com/google/play-services/setup.html
Note: You should be referencing a copy of the library that you copied to your development workspace—you should not reference the library directly from the Android SDK directory.
Upvotes: 0
Reputation: 17487
I had the same issue with a project using Maven and IntelliJ. Google Play services are added as a maven dependency. The maven build worked fine from command line, but IntelliJ complained about this missing symbol @integer/google_play_services_version
In my case I forced an update of the maven POM files and it solved the problem.
Upvotes: 1
Reputation: 4155
Google's Android Developer site has instructions on how to "Add Google Play Services to Your Project", and they are also relevant to how to upgrade the Play Services version. There is even a drop down menu to view instructions for either Eclipse, Android Studio, or "Something else". That would be the best place to view instructions in case they change. The page is here:
http://developer.android.com/google/play-services/setup.html
But since most of the answers here are for Eclipse, here is a brief summary for upgrading Play Services with Android Studio
You can find the version number for the version of play-services that you have downloaded on your development machine by looking in your \sdk\extras\google\m2repository\com\google\android\gms\play-services folder, as explained here: How do I match a Google Play Services revision with an install version?
Upvotes: 5
Reputation: 55
Solved for Eclipse
Follow the subsequent steps:
Upvotes: 6
Reputation: 7288
The problem for me was that the library project and the project using play services were in different directories. So just:
Upvotes: 0
Reputation: 3939
To anyone using gradle: don't include the project source, but instead download it using SDK Manager and add this line to dependencies:
compile 'com.google.android.gms:play-services:4.0.30'
Upvotes: 20
Reputation: 1740
While importing the google-play-services_lib, check the version code defined in AndroidManifest.xml and version.xml. I had found the difference in version code and change it to 4242000. After making the change there is no more compilation error in @integer/google_play_services_version.
Upvotes: 2
Reputation: 1706
I had same issue, the version.xml file was not in google-play-services_lib. Just start you sdk manager and accept the update especially the things related to "extras".
Upvotes: 3
Reputation: 226
compile 'com.google.android.gms:play-services:4.1.32@aar'
to your build.gradle
.@integer/google_play_services_version
will be available. Upvotes: 12
Reputation: 2814
I just updated Google Play services under the Extras folder in Android SDK Manager
Upvotes: 0
Reputation: 2846
Below are the main actions which will avoid a lot of errors when using Google play service Lib:
Upvotes: 1
Reputation: 494
I had the same issue. The issue was that the "google-play-services.jar" was not properly imported into my project even though it was part of the google_play_service_lib project. If you are using Eclipse, please check and see if you can see the play services jar file in the Android Private Libraries section and if this is exported by the library.
I am using Android SDK platform tools version 17 (not 19) and Android SDK tools version 22.0.1
Upvotes: 0
Reputation: 6764
I also ran across this while trying to use google_play_services_froyo.
I filed this bug: https://code.google.com/p/google-plus-platform/issues/detail?id=734
Upvotes: 7
Reputation: 391
On Eclipse, after importing the google play library to the project workspace I just copied the version.xml file from
google-play-services_lib/res/values/version.xml
to
MyProjectName/res/values/version.xml
Upvotes: 24
Reputation: 41
For Eclipse, I just added project reference to the google-play-services_lib in:
Properties-Android In the Library pane (bottom pane), ensure that the google-play-services_lib is listed. If not, click the Add.. button and select google-play-services_lib.
Upvotes: 4
Reputation: 3521
I faced the same issue, and apparently Eclipse somehow left the version.xml
file in /res/values from the original google-play-services_lib
project while making a copy. I pulled the file from original project and pasted it in my copy of the project and the problem is fixed.
Upvotes: 31
Reputation: 6832
Please note that this fix may only apply to IntelliJ users!! (More information at the bottom of this post that should apply to everyone.)
Fixed this problem! I use IntelliJ and it turns out I just had misconfigured the way I was including the google-play-services_lib
module as a dependency.
As I fixed this entirely through GUI and not at all by editing any files, here's a couple of screenshots:
So my Project Structure started off looking like this...
Then I removed the google-play-services
library from my dependencies list by selecting it and then clicking the minus button at the bottom. Notice the error at the bottom of the dialog, as my project absolutely does require this library. But don't worry, we'll re-add it soon!
Next I added google-play-services_lib
as a module dependency instead of a library dependency. Then I hit the up arrow button at the bottom a couple times to move this dependency to the top of the list. But notice the error at the bottom (we're still not done yet!)
I then clicked the lightbulb at the bottom of the dialog in the error message area to bring up this little small popup that gives two choices (Add to dependencies... or Remove Library). Click the Add to dependencies... option!
A new small dialog window should have popped up. It gave me two choices, one for my main project (it's name is blurred out), and then another for the google-play-services_lib
project. Yours may have a bunch more depending on your project (like you may see actionbarsherlock
, stuff like that). Select google-play-services_lib
and click okay!
And finally, you're done! I hope this helps someone else out there!
I believe the reason that this issue was happening to begin with is because I thought that I had properly included the entire google-play-services_lib
project into my overall project... but I actually had not, and had instead only properly included its jar file (google-play-services_lib/libs/google-play-services.jar
). That jar file only includes code, not Android resources values, and so as such the @integer/google_play_services_version
value was never really in my project. But the code was able to be used in my project, and so that made it seem like everything was fine.
And as a side note, fixing this issue also seems to have fixed the GooglePlayServicesUtil.getErrorDialog(...).show()
crash that I used to have. But that could also have been fixed by the update, not really 100% sure there.
Upvotes: 78
Reputation: 1006564
Off the cuff, it feels like your project is connected to an older version of the Play Services library project. The recommended approach, by Google, is for you to find the library project in the SDK and make a local copy. This does mean, though, that any time you update the Play Services library project through the SDK Manager, you also need to replace your copy with a fresh copy.
Upvotes: 10