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.
当将我的项目升级到最新版本的谷歌Play服务(v4.0, 2013年万圣节发布)时,您现在应该在AndroidManifest中添加一个新的标记。xml文件。
<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:
然后,我可以导航到google-play-services_lib/res/值/版本的文件。查看该符号的原始整数:
<integer name="google_play_services_version">4030500</integer>
And then insert it back into my AndroidManifest.xml
:
然后将它插入到我的android宣言中。
<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?
什么好主意吗?
24 个解决方案
#1
255
So for everyone using eclipse, this is how it's done:
所以对于每个使用eclipse的人来说,这就是它的实现方式:
Eclipse -> import -> existing android code -> browse -> navigate to google-play-services_lib FOLDER (android-sdk/extras/google/google_play_services/libproject).
Eclipse ->导入->现有android代码->浏览->导航到google-play-services_lib文件夹(android-sdk/extras/谷歌/google_play_services/libproject)。
then, on your project, control click -> properties -> android -> libraries, add -> select the project you just imported -> ok
然后,在您的项目上,控制单击->属性-> android ->库,添加->选择刚才导入的项目-> ok
#2
74
Please note that this fix may only apply to IntelliJ users!! (More information at the bottom of this post that should apply to everyone.)
请注意,此修复可能只适用于IntelliJ用户!!(这篇文章底部的更多信息应该适用于所有人。)
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.
解决这个问题!我使用IntelliJ,结果发现我只是把google-play-services_lib模块作为一个依赖项进行了错误的配置。
As I fixed this entirely through GUI and not at all by editing any files, here's a couple of screenshots:
由于我完全通过GUI修复了这个问题,而不是通过编辑任何文件,以下是一些截图:
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!
然后我从依赖列表中删除google-play-services库,选择它,然后单击底部的减按钮。请注意对话框底部的错误,因为我的项目绝对需要这个库。不过别担心,我们很快会重新添加的!
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!)
接下来,我添加了google-play-services_lib作为模块依赖项,而不是依赖于库。然后我点击底部的向上箭头按钮几次,将这个依赖项移动到列表的顶部。但是请注意底部的错误(我们还没有完成!)
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!
然后我点击错误消息区域对话框底部的灯泡,打开这个小弹出窗口,它提供两个选项(添加依赖项……)或删除库)。单击Add to dependencies…选择!
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!
应该会弹出一个新的小对话框窗口。它给了我两个选择,一个用于我的主项目(名字被模糊了),另一个用于google-play-services_lib项目。根据你的项目,你可能会有更多的项目(比如你可能会看到《神探夏洛克》之类的)。选择google-play-services_lib并单击ok !
And finally, you're done! I hope this helps someone else out there!
最后,你已经完成了!我希望这能帮助别人!
Further info
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.
我相信这个问题发生的原因是因为我认为我已经正确地将整个google-play-services_lib项目包含到我的整个项目中……但实际上我并没有,而且只正确地包含了它的jar文件(google-play-services_lib/libs/google-play-services.jar)。这个jar文件只包含代码,不包含Android资源值,因此,我的项目中从来没有真正包含@integer/google_play_services_version值。但是代码可以在我的项目中使用,所以看起来一切都很好。
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.
顺便说一句,修复这个问题似乎也修复了GooglePlayServicesUtil.getErrorDialog(…).show()崩溃,我以前也有过这种情况。但是这也可以通过更新得到修正,不是百分之百的确定。
#3
30
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.
我也遇到了同样的问题,显然Eclipse以某种方式离开了这个版本。从google-play-services_lib项目中复制/res/值的xml文件。我从原始项目中取出文件并粘贴到项目的副本中,问题得到了解决。
#4
24
On Eclipse, after importing the google play library to the project workspace I just copied the version.xml file from
在Eclipse中,在将谷歌play库导入到项目工作区之后,我复制了这个版本。xml文件从
google-play-services_lib/res/values/version.xml
to
来
MyProjectName/res/values/version.xml
#5
18
To anyone using gradle: don't include the project source, but instead download it using SDK Manager and add this line to dependencies:
对于任何使用gradle的人:不要包含项目源代码,而是使用SDK管理器下载,并将这一行添加到依赖项中:
compile 'com.google.android.gms:play-services:4.0.30'
#6
11
- Install "Google Play Services" and "Google Repository" from Android SDK Manager.
- 从Android SDK管理器安装“谷歌播放服务”和“谷歌储存库”。
- Add the line
compile 'com.google.android.gms:play-services:4.1.32@aar'
to yourbuild.gradle
. - 添加行编译'com.google.android.gms:play-services:4.1.32@aar'到您的build.gradle。
- As result the resource
@integer/google_play_services_version
will be available. - 因此,资源@integer/google_play_services_version将可用。
#7
9
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.
即兴地,感觉您的项目与旧版本的Play Services library项目相连接。谷歌推荐的方法是在SDK中查找库项目并生成本地副本。但是,这意味着任何时候通过SDK管理器更新Play Services库项目,您也需要用一个新的副本替换您的副本。
#8
7
after the update to the last versión i had this problem with all my projects, but it was solved just adding again the library reference:
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
).
如果你也´t图书馆在Eclipse工作区中您可以添加用:文件- > - >现有Android代码导入到工作区- >浏览和导航到google-play-services_lib项目*,(Android sdk /配件/谷歌/ google_play_services / libproject)。
then deleting /bin
and /gen
folders of my project (something similar to the clean option) and building my project again.
#9
6
I also ran across this while trying to use google_play_services_froyo.
我在尝试使用google_play_services_froyo时也遇到了这个问题。
I filed this bug: https://code.google.com/p/google-plus-platform/issues/detail?id=734
我提交了这个bug: https://code.google.com/p/goog -plus-platform/issues/detail?id=734
#10
6
Solved for Eclipse
为Eclipse解决
Follow the subsequent steps:
按照随后的步骤:
- Import the google-play-services_lib folder as project, using import->Existing Android Code Into Workspace
- 导入google-play-services_lib文件夹作为项目,使用导入->现有的Android代码进入工作空间。
- From the project properties select Android section, on the bottom In the Library section click Add and select the google-play-services_lib and Apply Follow the link http://i.stack.imgur.com/opSeJ.png to see the screenshot
- 从项目属性中选择Android部分,在库部分的底部单击Add,选择google-play-services_lib并应用Follow链接http://i.stack.imgur.com/opSeJ.png来查看屏幕截图
#11
5
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:
谷歌的Android开发者站点有关于如何“向您的项目添加谷歌Play服务”的说明,它们也与如何升级Play服务版本有关。甚至还有一个下拉菜单来查看Eclipse、Android Studio或“其他东西”的指令。这是查看指令的最佳位置,以防它们发生变化。这里的页面:
http://developer.android.com/google/play-services/setup.html
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
但是,由于这里的大多数答案都是针对Eclipse的,所以这里有一个简短的总结,用于使用Android Studio升级Play服务
- Open the build.gradle file inside your application module directory. Note: Android Studio projects contain a top-level build.gradle file and a build.gradle file for each module. Be sure to edit the file for your application module.
- 构建开放。应用程序模块目录中的渐变文件。注意:Android Studio项目包含一个*构建。渐变文件和构建。每个模块的渐变文件。确保编辑应用程序模块的文件。
- Update the build rule under "dependencies" to refer the version of play-services that you have downloaded on your development machine.
- 更新“依赖项”下的构建规则,以参考您在开发机器上下载的游戏服务的版本。
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?
你可以在你的开发机器上下载的游戏服务版本的版本号,可以在你的\sdk\extras\谷歌\m2repository\com\谷歌\谷歌\谷歌\android\gms\ Play - Services文件夹中找到。
#12
4
For Eclipse, I just added project reference to the google-play-services_lib in:
对于Eclipse,我只是将项目引用添加到google-play-services_lib中:
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.
属性- android在Library窗格(底部窗格)中,确保列出了google-play-services_lib。如果没有,点击添加。按钮并选择google-play-services_lib。
#13
3
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".
我有同样的问题,版本。xml文件不在google-play-services_lib中。只要启动sdk管理器并接受更新,特别是与“附加功能”相关的内容。
#14
2
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.
在导入google-play-services_lib时,检查AndroidManifest中定义的版本代码。xml和version.xml。我发现了版本代码的差异并将其更改为4242000。修改之后,在@integer/google_play_services_version中不再出现编译错误。
#15
2
Fixed by adding Google Play Services to my Module:app gradle build file. Documentation also says to update version when you update GMS.
通过添加谷歌播放服务到我的模块:app gradle构建文件修复。文档还要求在更新GMS时更新版本。
dependencies {
compile 'com.google.android.gms:play-services:9.6.1'
}
#16
1
Below are the main actions which will avoid a lot of errors when using Google play service Lib:
下面是使用谷歌play服务库时避免大量错误的主要操作:
- Make sure to copy the lib project to the Eclipse projects workspace.
- 确保将lib项目复制到Eclipse项目工作区。
- Target SDK for Google play service lib project should be "Google
- 谷歌play服务库项目的目标SDK应该是“谷歌”
- API" 3- Meta data should be added to manifest file.
- API" 3-元数据应该添加到清单文件。
- Your project target SDK should be 17 unless you've completely updated to 19, because in some cases 19 not working well.
- 您的项目目标SDK应该是17,除非您已经完全更新到19,因为在某些情况下19不能正常工作。
#17
1
In my case, I needed to copy the google-play-services_lib FOLDER in the same DRIVE of the source codes of my apps
在我的例子中,我需要将google-play-services_lib文件夹复制到应用程序源代码的同一驱动器中
- F:\Products\Android\APP*.java <- My Apps are here so I copied to folder below
- F:\ Android产品\ \应用*。java <-我的应用程序在这里,所以我复制到下面的文件夹
- F:\Products\Android\libs\google-play-services_lib
- F:\ Android产品\ \ libs \ google-play-services_lib
#18
1
When not using an IDE, but using command line builds (using ant and ndk-build), this is how to solve it:
当不使用IDE,而是使用命令行构建(使用ant和ndk构建)时,这就是解决方法:
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”命令安装所有req部件。然后在您的项目根目录中有一个google-play-service_lib/的副本。编辑项目。包含这一行的属性:
android.library.reference.1=./google-play-services_lib
#19
0
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.
我也有同样的问题。问题在于“谷歌播放服务”。尽管它是google_play_service_lib项目的一部分,但它并没有正确地导入到我的项目中。如果您正在使用Eclipse,请检查并查看您是否可以在Android Private Libraries部分看到play services jar文件,如果这是由库导出的。
I am using Android SDK platform tools version 17 (not 19) and Android SDK tools version 22.0.1
我正在使用Android SDK平台工具版本17(不是19)和Android SDK工具版本22.0.1
#20
0
I just updated Google Play services under the Extras folder in Android SDK Manager
我刚刚在Android SDK管理器的Extras文件夹下更新了谷歌Play services
#21
0
The problem for me was that the library project and the project using play services were in different directories. So just:
我的问题是,库项目和使用play服务的项目位于不同的目录中。所以只要:
- 1.Add the files to the same workspace then remove the library.
- 1。将文件添加到相同的工作区,然后删除库。
- 2.Restart eclipse
- 2。重新启动eclipse
- 3.Add the library project again
- 3所示。再次添加库项目
- 4.Clear
- 4.明确
#22
0
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
我在一个使用Maven和IntelliJ的项目中遇到了同样的问题。谷歌Play服务作为maven依赖项添加。maven构建从命令行运行良好,但是IntelliJ抱怨这个缺失的符号@integer/google_play_services_version
In my case I forced an update of the maven POM files and it solved the problem.
在我的例子中,我强制更新maven POM文件,它解决了这个问题。
#23
0
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.
谷歌建议您不要直接从SDK目录创建项目。最好将lib项目复制到应用程序所在的位置,然后从那里导入。否则,下次您去为另一个应用程序导入项目时,它已经在使用了。
https://developer.android.com/google/play-services/setup.html
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.
注意:您应该引用复制到开发工作空间的库的副本,您不应该直接从Android SDK目录引用该库。
#24
0
Anybody looking in 2017, the 10.0.1 version of play services requires importing play-services-basement
(use to be in play-services-base
).
任何想要在2017年推出10.0.1版的play services的人都需要导入play-services-base(用于play-services-base)。
#1
255
So for everyone using eclipse, this is how it's done:
所以对于每个使用eclipse的人来说,这就是它的实现方式:
Eclipse -> import -> existing android code -> browse -> navigate to google-play-services_lib FOLDER (android-sdk/extras/google/google_play_services/libproject).
Eclipse ->导入->现有android代码->浏览->导航到google-play-services_lib文件夹(android-sdk/extras/谷歌/google_play_services/libproject)。
then, on your project, control click -> properties -> android -> libraries, add -> select the project you just imported -> ok
然后,在您的项目上,控制单击->属性-> android ->库,添加->选择刚才导入的项目-> ok
#2
74
Please note that this fix may only apply to IntelliJ users!! (More information at the bottom of this post that should apply to everyone.)
请注意,此修复可能只适用于IntelliJ用户!!(这篇文章底部的更多信息应该适用于所有人。)
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.
解决这个问题!我使用IntelliJ,结果发现我只是把google-play-services_lib模块作为一个依赖项进行了错误的配置。
As I fixed this entirely through GUI and not at all by editing any files, here's a couple of screenshots:
由于我完全通过GUI修复了这个问题,而不是通过编辑任何文件,以下是一些截图:
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!
然后我从依赖列表中删除google-play-services库,选择它,然后单击底部的减按钮。请注意对话框底部的错误,因为我的项目绝对需要这个库。不过别担心,我们很快会重新添加的!
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!)
接下来,我添加了google-play-services_lib作为模块依赖项,而不是依赖于库。然后我点击底部的向上箭头按钮几次,将这个依赖项移动到列表的顶部。但是请注意底部的错误(我们还没有完成!)
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!
然后我点击错误消息区域对话框底部的灯泡,打开这个小弹出窗口,它提供两个选项(添加依赖项……)或删除库)。单击Add to dependencies…选择!
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!
应该会弹出一个新的小对话框窗口。它给了我两个选择,一个用于我的主项目(名字被模糊了),另一个用于google-play-services_lib项目。根据你的项目,你可能会有更多的项目(比如你可能会看到《神探夏洛克》之类的)。选择google-play-services_lib并单击ok !
And finally, you're done! I hope this helps someone else out there!
最后,你已经完成了!我希望这能帮助别人!
Further info
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.
我相信这个问题发生的原因是因为我认为我已经正确地将整个google-play-services_lib项目包含到我的整个项目中……但实际上我并没有,而且只正确地包含了它的jar文件(google-play-services_lib/libs/google-play-services.jar)。这个jar文件只包含代码,不包含Android资源值,因此,我的项目中从来没有真正包含@integer/google_play_services_version值。但是代码可以在我的项目中使用,所以看起来一切都很好。
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.
顺便说一句,修复这个问题似乎也修复了GooglePlayServicesUtil.getErrorDialog(…).show()崩溃,我以前也有过这种情况。但是这也可以通过更新得到修正,不是百分之百的确定。
#3
30
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.
我也遇到了同样的问题,显然Eclipse以某种方式离开了这个版本。从google-play-services_lib项目中复制/res/值的xml文件。我从原始项目中取出文件并粘贴到项目的副本中,问题得到了解决。
#4
24
On Eclipse, after importing the google play library to the project workspace I just copied the version.xml file from
在Eclipse中,在将谷歌play库导入到项目工作区之后,我复制了这个版本。xml文件从
google-play-services_lib/res/values/version.xml
to
来
MyProjectName/res/values/version.xml
#5
18
To anyone using gradle: don't include the project source, but instead download it using SDK Manager and add this line to dependencies:
对于任何使用gradle的人:不要包含项目源代码,而是使用SDK管理器下载,并将这一行添加到依赖项中:
compile 'com.google.android.gms:play-services:4.0.30'
#6
11
- Install "Google Play Services" and "Google Repository" from Android SDK Manager.
- 从Android SDK管理器安装“谷歌播放服务”和“谷歌储存库”。
- Add the line
compile 'com.google.android.gms:play-services:4.1.32@aar'
to yourbuild.gradle
. - 添加行编译'com.google.android.gms:play-services:4.1.32@aar'到您的build.gradle。
- As result the resource
@integer/google_play_services_version
will be available. - 因此,资源@integer/google_play_services_version将可用。
#7
9
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.
即兴地,感觉您的项目与旧版本的Play Services library项目相连接。谷歌推荐的方法是在SDK中查找库项目并生成本地副本。但是,这意味着任何时候通过SDK管理器更新Play Services库项目,您也需要用一个新的副本替换您的副本。
#8
7
after the update to the last versión i had this problem with all my projects, but it was solved just adding again the library reference:
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
).
如果你也´t图书馆在Eclipse工作区中您可以添加用:文件- > - >现有Android代码导入到工作区- >浏览和导航到google-play-services_lib项目*,(Android sdk /配件/谷歌/ google_play_services / libproject)。
then deleting /bin
and /gen
folders of my project (something similar to the clean option) and building my project again.
#9
6
I also ran across this while trying to use google_play_services_froyo.
我在尝试使用google_play_services_froyo时也遇到了这个问题。
I filed this bug: https://code.google.com/p/google-plus-platform/issues/detail?id=734
我提交了这个bug: https://code.google.com/p/goog -plus-platform/issues/detail?id=734
#10
6
Solved for Eclipse
为Eclipse解决
Follow the subsequent steps:
按照随后的步骤:
- Import the google-play-services_lib folder as project, using import->Existing Android Code Into Workspace
- 导入google-play-services_lib文件夹作为项目,使用导入->现有的Android代码进入工作空间。
- From the project properties select Android section, on the bottom In the Library section click Add and select the google-play-services_lib and Apply Follow the link http://i.stack.imgur.com/opSeJ.png to see the screenshot
- 从项目属性中选择Android部分,在库部分的底部单击Add,选择google-play-services_lib并应用Follow链接http://i.stack.imgur.com/opSeJ.png来查看屏幕截图
#11
5
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:
谷歌的Android开发者站点有关于如何“向您的项目添加谷歌Play服务”的说明,它们也与如何升级Play服务版本有关。甚至还有一个下拉菜单来查看Eclipse、Android Studio或“其他东西”的指令。这是查看指令的最佳位置,以防它们发生变化。这里的页面:
http://developer.android.com/google/play-services/setup.html
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
但是,由于这里的大多数答案都是针对Eclipse的,所以这里有一个简短的总结,用于使用Android Studio升级Play服务
- Open the build.gradle file inside your application module directory. Note: Android Studio projects contain a top-level build.gradle file and a build.gradle file for each module. Be sure to edit the file for your application module.
- 构建开放。应用程序模块目录中的渐变文件。注意:Android Studio项目包含一个*构建。渐变文件和构建。每个模块的渐变文件。确保编辑应用程序模块的文件。
- Update the build rule under "dependencies" to refer the version of play-services that you have downloaded on your development machine.
- 更新“依赖项”下的构建规则,以参考您在开发机器上下载的游戏服务的版本。
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?
你可以在你的开发机器上下载的游戏服务版本的版本号,可以在你的\sdk\extras\谷歌\m2repository\com\谷歌\谷歌\谷歌\android\gms\ Play - Services文件夹中找到。
#12
4
For Eclipse, I just added project reference to the google-play-services_lib in:
对于Eclipse,我只是将项目引用添加到google-play-services_lib中:
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.
属性- android在Library窗格(底部窗格)中,确保列出了google-play-services_lib。如果没有,点击添加。按钮并选择google-play-services_lib。
#13
3
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".
我有同样的问题,版本。xml文件不在google-play-services_lib中。只要启动sdk管理器并接受更新,特别是与“附加功能”相关的内容。
#14
2
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.
在导入google-play-services_lib时,检查AndroidManifest中定义的版本代码。xml和version.xml。我发现了版本代码的差异并将其更改为4242000。修改之后,在@integer/google_play_services_version中不再出现编译错误。
#15
2
Fixed by adding Google Play Services to my Module:app gradle build file. Documentation also says to update version when you update GMS.
通过添加谷歌播放服务到我的模块:app gradle构建文件修复。文档还要求在更新GMS时更新版本。
dependencies {
compile 'com.google.android.gms:play-services:9.6.1'
}
#16
1
Below are the main actions which will avoid a lot of errors when using Google play service Lib:
下面是使用谷歌play服务库时避免大量错误的主要操作:
- Make sure to copy the lib project to the Eclipse projects workspace.
- 确保将lib项目复制到Eclipse项目工作区。
- Target SDK for Google play service lib project should be "Google
- 谷歌play服务库项目的目标SDK应该是“谷歌”
- API" 3- Meta data should be added to manifest file.
- API" 3-元数据应该添加到清单文件。
- Your project target SDK should be 17 unless you've completely updated to 19, because in some cases 19 not working well.
- 您的项目目标SDK应该是17,除非您已经完全更新到19,因为在某些情况下19不能正常工作。
#17
1
In my case, I needed to copy the google-play-services_lib FOLDER in the same DRIVE of the source codes of my apps
在我的例子中,我需要将google-play-services_lib文件夹复制到应用程序源代码的同一驱动器中
- F:\Products\Android\APP*.java <- My Apps are here so I copied to folder below
- F:\ Android产品\ \应用*。java <-我的应用程序在这里,所以我复制到下面的文件夹
- F:\Products\Android\libs\google-play-services_lib
- F:\ Android产品\ \ libs \ google-play-services_lib
#18
1
When not using an IDE, but using command line builds (using ant and ndk-build), this is how to solve it:
当不使用IDE,而是使用命令行构建(使用ant和ndk构建)时,这就是解决方法:
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”命令安装所有req部件。然后在您的项目根目录中有一个google-play-service_lib/的副本。编辑项目。包含这一行的属性:
android.library.reference.1=./google-play-services_lib
#19
0
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.
我也有同样的问题。问题在于“谷歌播放服务”。尽管它是google_play_service_lib项目的一部分,但它并没有正确地导入到我的项目中。如果您正在使用Eclipse,请检查并查看您是否可以在Android Private Libraries部分看到play services jar文件,如果这是由库导出的。
I am using Android SDK platform tools version 17 (not 19) and Android SDK tools version 22.0.1
我正在使用Android SDK平台工具版本17(不是19)和Android SDK工具版本22.0.1
#20
0
I just updated Google Play services under the Extras folder in Android SDK Manager
我刚刚在Android SDK管理器的Extras文件夹下更新了谷歌Play services
#21
0
The problem for me was that the library project and the project using play services were in different directories. So just:
我的问题是,库项目和使用play服务的项目位于不同的目录中。所以只要:
- 1.Add the files to the same workspace then remove the library.
- 1。将文件添加到相同的工作区,然后删除库。
- 2.Restart eclipse
- 2。重新启动eclipse
- 3.Add the library project again
- 3所示。再次添加库项目
- 4.Clear
- 4.明确
#22
0
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
我在一个使用Maven和IntelliJ的项目中遇到了同样的问题。谷歌Play服务作为maven依赖项添加。maven构建从命令行运行良好,但是IntelliJ抱怨这个缺失的符号@integer/google_play_services_version
In my case I forced an update of the maven POM files and it solved the problem.
在我的例子中,我强制更新maven POM文件,它解决了这个问题。
#23
0
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.
谷歌建议您不要直接从SDK目录创建项目。最好将lib项目复制到应用程序所在的位置,然后从那里导入。否则,下次您去为另一个应用程序导入项目时,它已经在使用了。
https://developer.android.com/google/play-services/setup.html
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.
注意:您应该引用复制到开发工作空间的库的副本,您不应该直接从Android SDK目录引用该库。
#24
0
Anybody looking in 2017, the 10.0.1 version of play services requires importing play-services-basement
(use to be in play-services-base
).
任何想要在2017年推出10.0.1版的play services的人都需要导入play-services-base(用于play-services-base)。