0
本週早些時候我遇到了一個問題。當我嘗試執行Android版本構建時,它似乎顯示以下錯誤 -Android構建問題
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzjm.class
我想知道我是如何得到這個錯誤以及如何解決它的。看起來問題似乎是在build.gradle文件中。在這裏,他們是 -
應用級 -
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.unknown.app"
minSdkVersion 13
targetSdkVersion 23
versionCode 20
versionName "2.34"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':BaseGameUtils')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.firebase:firebase-ads:9.0.2'
compile ('com.google.android.gms:play-services:9.0.2'){
exclude group: 'com.google.android.gms.play-services-ads'
}
}
apply plugin: 'com.google.gms.google-services'
這裏是頂級 -
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
感謝所有幫助。我一直在討論這個問題。我找不到任何其他堆棧溢出問題的答案。再次感謝。
也許這個鏈接可能會幫助你>> http://stackoverflow.com/questions/33209631/errorexecution-failed-for-task-apptransformclasseswithjarmergingfordebug – mgcaguioa
我以前試過,雖然它沒有工作。儘管感謝您的幫助。 –
可能會出現此錯誤,因爲您有兩個具有相同類的相同庫。我認爲你必須從頂級build.gradle – Konstantin