【发布时间】:2017-08-30 19:04:55
【问题描述】:
我正在使用 libgdx 和 Android 工作室。我已经成功实现了 google play 游戏服务(排行榜等)。现在我想实现 admob,但我得到了错误。
这是我的 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")
}
}
如果我按 build->clean projects,一切似乎都很好,但是当我想在我的 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里面是什么? -
tween-engine-api.jar和tween-engine-api-sources.jar。在我的 android/libs 中只有 libgdx 相关的东西。
标签: android libgdx admob google-play-services