我正在使用libgdx和Android工作室。我已經成功實施谷歌玩遊戲服務(排行榜等)。現在我想實現admob,但是我得到錯誤。同時使用AdMob和Google Play遊戲服務時出錯
這是我的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"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
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.google.android.gms:play-services-games:11.2.0'
compile 'com.google.android.gms:play-services-ads:11.2.0'
//compile 'com.google.android.gms:play-services:10.0.1'
compile fileTree(dir: '../libs', include: '*.jar')
compile project(":BaseGameUtils")
}
}
如果我按建設 - >清潔項目,似乎一切都很好,但是當我想要我的Android手機上運行應用程序,我得到這個錯誤:
Error:Execution failed for task
':android:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzqv.class
這是compile 'com.google.android.gms:play-services-ads:11.2.0'
一部分弄亂的東西了。如果我刪除該行,則所有內容都可以像以前一樣運行,但我無法使用AdMob。
任何人都知道問題可能是什麼?
當我使用Eclipse時,我將google-play-service庫包含爲一個項目,並且不需要向build.gradle添加任何內容...爲什麼它在AndroidStudios中有所不同?
裏面是什麼'libs'? – Aryan
'tween-engine-api.jar'和'tween-engine-api-sources.jar'。而在我的android/libs只有libgdx相關的東西。 – lijas