【发布时间】:2014-05-07 13:24:55
【问题描述】:
使用 Eclipse IDE
关注:https://developers.google.com/games/services/android/quickstart
- 使用 google-play-services_lib 的副本(按照推荐)并作为 Eclipse 项目导入。
-
编辑游戏清单:
将我们的 APP ID 添加到 res/values/strings.xml
将 google-play-services_lib 与我们的游戏项目相关联,并在项目设置中的 Order 和 Export 选项卡中设置引用
按照https://developers.google.com/games/services/android/init使用BaseGameUtils项目,我们的Activity不能从该项目继承,因为已经有另一个类了。
因此,我们移至不继承的第二个方法(请参阅在没有 BaseGameActivity 的情况下使用 GameHelper)。我们为 BaseGameUtils 链接了 google-play-services_lib 并设置了库(编译成功)。
为我们的项目添加了链接,以便能够使用 GameHelper 以及 google-play-services_lib。
此时来自 Facebook 的 SDK 开始出现问题,因此我们不得不添加 android-support-v4.jar(BaseGameUtils 也使用)并在编译过程中出现错误:
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 only at this time).
All versions of the libraries must be the same at this time.
Versions found are:
Path: /Users/travis/Work/Craneballs/Mafia_android/facebook-android-sdk/facebook/libs/android-support-v4.jar
路径:/Users/travis/Work/Craneballs/Mafia_android/BaseGameUtils/libs/android-support-v4.jar
- 项目可以启动,但在 GoogleHelper = new GameHelper(this, GameHelper.CLIENT_ALL) 上崩溃
带有错误消息:
java.lang.NoClassDefFoundError: com.google.example.games.basegameutils.GameHelper
我为此花费了许多痛苦的时间,现在已经不知所措了。有什么想法吗?
【问题讨论】: