2017-09-13 104 views
0

我知道有這樣的問題,但我還沒有找到任何有用的答案。所以Gradle Console報告這個錯誤:com.android.build.api.transform.TransformException:java.util.zip.ZipException gradle build失敗

* What went wrong: 
Execution failed for task ':android:transformClassesWithJarMergingForDebug'. 
> com.android.build.api.transform.TransformException: 
java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzbvq.class 

我找不到我重複的依賴關係。

project(":android") { 
apply plugin: "android" 

configurations { natives } 

dependencies { 
    compile project(":core") 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.google.android.gms:play-services-ads:11.2.0' 
    compile 'com.google.android.gms:play-services-games:11.2.2' 
    compile 'com.android.support:support-annotations:24.2.0' 
    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" 
    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" 


} 

}

+0

什麼是':core'的依賴關係? 'libs /'中有哪些JAR? – CommonsWare

+0

從輸出運行'gradlew android:dependencies'併發布'releaseCompileClasspath'節 – DeKaNszn

回答

1

你必須使用遊戲庫的版本相同。

更改下面的線在你搖籃

compile 'com.google.android.gms:play-services-ads:11.2.0' 
compile 'com.google.android.gms:play-services-games:11.2.2' 

要:

compile 'com.google.android.gms:play-services-ads:11.2.2' 
compile 'com.google.android.gms:play-services-games:11.2.2' 

那麼幹淨和重建項目。

希望它有幫助:)

1

只是改變你的播放庫的版本。像下面一樣,因爲你必須使用相同的版本庫

compile 'com.google.android.gms:play-services-ads:11.2.2' 
compile 'com.google.android.gms:play-services-games:11.2.2' 
相關問題