Android的游戏无法安装服务排行榜(BaseGameUtils) [英] Android Play Services Leaderboard cannot be installed (BaseGameUtils)
问题描述
我按照 https://developers.google.com/games/services/android/初始化设置排行榜。所以在我的游戏项目我已经安装google_play_services lib中,因为它已经使用的AdMob。现在我需要所有的同时BaseGameUtils。但在链接节设置您的游戏项目上述步骤不起作用。让我告诉我做了什么:
- https://github.com/playgameservices/android-basic-samples 和pressed下载ZIP。
- 提取压缩和进口的文件夹到我的项目。 Disselected一切,只选择了
BasicSamples /库/ BaseGameUtils / src目录/主
这是我的项目中加入主
而不是为BaseGameUtils
。 - 右键点击
主
项目,在属性 - >的Android
选定的部分是图书馆
在我的游戏项目在属性 - >的Android
部分添加引用主
图书馆。 (请注意,如果你不选择是库
你不能做6。在库面板中,单击Add按钮。7.选择BaseGameUtils。
一步,因为它指出了教程) - 在我的包src目录下创建这样一个新的类:
进口gms.common.api *。进口com.google.example.games.basegameutils.BaseGameActivity;公共类MyGameActivity扩展BaseGameActivity {
块引用>但无论是进口的确认。如何设置呢?这本来是那么容易,但会这样creapy?
解决方案的步骤是在本教程不完整的。下面是实际的步骤:
打开<一个href=\"https://github.com/playgameservices/android-basic-samples\">https://github.com/playgameservices/android-basic-samples和pressed下载ZIP或者你可以克隆混帐回购协议了。
然后有一个
脚本/ make_eclipse_compat
(.CMD适用于Windows)的脚本。CD Android的基本采样;
并运行该脚本。它生成eclipse_compat
旁边的脚本
DIR。导入到Eclipse
Android的基本采样/ eclipse_compat /库/ BaseGameUtils
,而不是原始的BaseGameUtils
下载。请注意,在这种情况下,在Eclipse中你没有得到添加有主
项目,而是一项名为BaseGameUtils
。在
BaseGameUtils
项目右键单击转到属性 - &GT;的Android
并确保是库
被选中并添加google_play_services
作为参考库。如果您使用Facebook的例子SDK或其他的SDK,那么你可能有这样的冲突:
找到2版本的依赖列表Android的支持 - v4.jar,但
不是所有的版本是相同的(检查基于SHA-1 ........
块引用>下面是分辨率:<一href=\"http://stackoverflow.com/questions/13517222/facebook-sdk-for-android-duplicate-support-library-on-dependencies\">Facebook SDK对Android的依赖重复支持库
<醇开始=6>同时
进口gms.common.api。*;
是不对的,你应该这样做:
进口com.google.android.gms.common.api *。
进口com.google.example.games.basegameutils.BaseGameActivity;
公共类MyGameActivity扩展BaseGameActivity {I follow https://developers.google.com/games/services/android/init to setup leaderboards. So in my game project I have setup google_play_services lib as it already uses AdMob. Now I need to all Also BaseGameUtils. But the steps in section "Setting up your game project" in the link above don't work. Let me tell what I have done:
- Opened https://github.com/playgameservices/android-basic-samples and pressed "Download ZIP".
- Extracted the zip and imported the folder into my project. Disselected all and selected only
BasicSamples/libraries/BaseGameUtils/src/main
which was added in my project asmain
and not asBaseGameUtils
.- Right clicked on
main
project, inProperties->Android
section selectedIs Library
and in my game project inProperties->Android
section added Reference tomain
library. (Note that if you don't selectIs Library
you cannot do6. In the Library panel, click the Add button. 7.Select BaseGameUtils.
step as it is pointed out in the tutorial )- In my package src directory create a new class like this:
import gms.common.api.*; import com.google.example.games.basegameutils.BaseGameActivity; public class MyGameActivity extends BaseGameActivity {
but neither of the imports is recognized. How to setup this? This should have been to be so easy but is it so creapy?
解决方案The steps are incomplete in the tutorial. Here are the actual steps:
Opened https://github.com/playgameservices/android-basic-samples and pressed "Download ZIP" or you can clone the git repo too.
Then there is a
Scripts/make_eclipse_compat
(.cmd for Windows) script.cd android-basic-samples;
and run the script. It generateseclipse_compat
next toScripts
dir.Import into eclipse
android-basic-samples/eclipse_compat/libraries/BaseGameUtils
and not the originalBaseGameUtils
downloaded. Note that in this case in Eclipse you are not getting add theremain
project but a project calledBaseGameUtils
.Right click on
BaseGameUtils
project go toProperties->Android
and make sureIs Library
is checked and addgoogle_play_services
as Reference library.If you use for example Facebook SDK or other SDKs then you may have such a conflict:
Found 2 versions of android-support-v4.jar in the dependency list, but not all the versions are identical (check is based on SHA-1........
Here is the resolution: Facebook SDK for Android duplicate support library on dependencies
Also
import gms.common.api.*;
is wrong you should do this:
import com.google.android.gms.common.api.*; import com.google.example.games.basegameutils.BaseGameActivity; public class MyGameActivity extends BaseGameActivity {
这篇关于Android的游戏无法安装服务排行榜(BaseGameUtils)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!