【发布时间】:2019-02-12 02:22:37
【问题描述】:
我使用 Libgdx 库制作了一款游戏。现在我想在我的游戏中添加一个排行榜表。为此,我遵循了本教程:here
但在那个教程中,我停留在第 29 步。因为我的导入没有解决。
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.drive.Drive;
import com.google.android.gms.games.Games;
import com.google.android.gms.games.Games.GamesOptions;
import com.google.android.gms.games.GamesActivityResultCodes;
import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch;
import com.google.android.gms.games.request.GameRequest;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.Plus.PlusOptions;
例如,在我写了import com.google.android.gms.games 和. 之后,只有两个提示出现在我面前:R 和*。
在 sdk manager 中,已经安装了 Google Play Services。(我用的是 Android Studio)
另外,这是我的项目 build.gradle for Android:
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile "com.google.android.gms:play-services-games:15.0.1"// I think this line should solve all imports problem, but it can't
compile "com.google.android.gms:play-services-auth:16.0.0"
compile "com.google.android.gms:play-services-auth:11.6.0"
compile 'com.google.android.gms:play-services:+'
compile project(":core")
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-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
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-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
}
}
我可以做些什么来解决这个问题?
【问题讨论】:
-
为什么你有
play-services-auth但有两个不同的版本?那是个问题。还有为什么如果你声明play-services:+是在使用谷歌播放服务库的特定部分,那是另一个问题 -
@tyczj 因为,当我搜索我的问题时,我将所有解决方案类型添加到我的 gradle 以保证它。
-
好吧,您所做的会导致冲突和不正确,您使用的是旧版本的 google play 服务,应该阅读如何正确导入 google play 服务
标签: android gradle libgdx google-play-services google-play-games