當試圖編譯我的代碼我得到:Android編譯APK:重複條目
Error: Execution failed for task ':android:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzjm.class
這似乎錯誤是在的build.gradle文件。這是根的build.gradle:
// Ed's note: apparent missing line here from original post
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
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"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
和android的build.gradle包含:
dependencies {
compile project(':baseGameUtils')
//compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/appbrain-applift-sdk-10.51.jar')
compile 'com.google.android.gms:play-services-ads:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
您在[原始文章](https://stackoverflow.com/revisions/44913946/2)中使用了「entry」標記,[已棄用](https://meta.stackoverflow.com/問題/ 349778 /),所以我想我會看看使用它的問題。我在你的問題中注意到了一些事情......在你的根build.gradle的頂部缺少一行,還有一些粗略的[L-sep](https://stackoverflow.com/questions/41555397/)字符android build.gradle。我提到在與您的問題有關的機會中刪除它們,例如垃圾文件中的不可見字符或缺失的行。 – HostileFork
我會補充一點,如果你想知道爲什麼這個問題會被低估,那是因爲你說*「看起來錯誤在build.gradle文件中」*然後你給他們。您不提供任何理由說明您爲什麼相信這一點(請注意,術語'zzjm'沒有出現在您呈現的任何地方),並且您沒有提供[最小,完整,可驗證示例](https:/ /stackoverflow.com/help/mcve)哪些人可以獨立測試和重現錯誤。這並不是說你的猜測是錯誤的,但它不是一個猜測遊戲......研究導致問題的最小例子。 – HostileFork