找到一些信息后我的确切位置:
- BaseGameUtils 文件夹在我的根文件夹中。
- google-play-services_lib 在我的根文件夹中
- 我的 settings.gradle 被修改为:include 'desktop', 'android', 'core', "BaseGameUtils"因为我只使用桌面和 Android 项目
- 将编译项目(":BaseGameUtils") 作为android 依赖添加到我的build.gradle
我是 gradle 概念的新手,所以,我现在有点迷茫。 我可以找到 Intellij 的任何教程,其中大部分是针对 Eclipse 的。 一些帮助将不胜感激 =)
编辑 1:
经过几个小时的测试,这就是我得到的。
将使用 Libgdx 的安装程序创建的项目导入到 Intellij 中,并检查高级选项“IDEA”。 (intellij 启动时通过弹出窗口加载 Gradle)[这真的需要吗?]
设置 BaseGameUtils:
将 BaseGameUtils 文件夹移动到项目的根文件夹中。 将 BaseGameUtils 作为模块添加到您的项目中。 将 google-play-service.jar 添加到 BaseGameUtils 模块。
设置 Android 项目:
将BaseGameUtils作为模块依赖添加到Android项目
这就是我迷路的地方:
在核心项目中创建一个接口(interface),向其添加位于 BaseGameActivity 中的函数。 使 Android 项目的主类“AndroidLauncher.java”实现 GameServiceInterface 和 GameHelperListener。 将缺少的方法添加到 Android 项目的主类“AndroidLauncher.java”。
最佳答案
libgdx wiki 上有教程.
从 Android SDK 管理器安装“Google Play 存储库”应该就足够了。无需移动 google-play-services_lib 文件夹。
我在 root/bulild.gradle 中的 android 项目定义:
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile project(":libraries:BaseGameUtils")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services:5.0+'
}
}
关于java - 如何实现Google Play游戏服务、Intellij、libgdx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28048125/