J'ai essayé d'implémenter les services de jeux google play dans mon jeu libgdx avec BaseGameUtils dans le studio android depuis un certain temps et cela fonctionne et initialiser correctement, mais seulement dans les dernières versions de Android comme Oreo ou Nougat. Les versions antérieures montrent l'exception suivante dès l'ouverture de l'application:GoogleApiClient erreur dans lollipop et versions antérieures
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xx.mygame, PID: 1234
java.lang.VerifyError: com/google/android/gms/common/api/GoogleApiClient$Builder
at com.google.example.games.basegameutils.GameHelper.createApiClientBuilder(GameHelper.java:260)
at com.google.example.games.basegameutils.GameHelper.setup(GameHelper.java:297)
at com.xx.mygame.AndroidLauncher.onCreate(AndroidLauncher.java:31)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
J'enquêtait sur les fichiers du module BaseGameUtils essayer d'identifier le problème, mais je ne peux rien faire. Toute aide appréciée
Ceci est le fichier build.gradle:
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
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"
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-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
compile "com.android.support:support-core-utils:26.0.0"
compile 'com.google.android.gms:play-services-base:11.0.4'
compile "com.google.android.gms:play-services-games:11.0.4"
compile project(":BaseGameUtils")
}}
build.gradle (Module: BaseGameUtils)
dependencies {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('appcompat_library_version')) {
ext.appcompat_library_version = '20.0.+'
}
if (!project.hasProperty('support_library_version')) {
ext.support_library_version = '20.0.+'
}
if (!project.hasProperty('gms_library_version')) {
ext.gms_library_version = '8.4.0'
}
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
compile "com.google.android.gms:play-services-plus:${gms_library_version}"
}
android {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('android_compile_version')) {
ext.android_compile_version = 23
}
if (!project.hasProperty('android_version')) {
ext.build_tools_version = "23.0.2"
}
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('android_min_sdk_version')) {
// Google Play Services minimum requirements is 14
ext.android_min_sdk_version = 14
}
compileSdkVersion android_compile_version
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion android_min_sdk_version
targetSdkVersion android_compile_version
}
}
show 'build.gradle' fichiers ayant des dépendances pour Android comme fichier' 'build.gradle' de BaseGameUtils' et le module Android. – Aryan
@AbhishekAryan Ok, j'ai déjà coller le build.gradle! –