我使用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管理器中,已经安装了Google Play服务。(我使用的是Android Studio)
此外,这是我的Android项目build.gradle:
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"
}
}
我该怎么做才能解决这个问题?
答案 0 :(得分:2)
您缺少play-services-base
库:
compile "com.google.android.gms:play-services-base:15.0.1"
compile "com.google.android.gms:play-services-auth:16.0.0"
compile "com.google.android.gms:play-services-games:15.0.1"
...,以及由于任何原因两次添加play-services-auth
。并且play-services:+
似乎不正确,因此也应将其删除。使用新版本控制时,必须单独添加这些依赖项。
答案 1 :(得分:1)