':app:transformClassesWithJarMergingForDebug' 的重复条目 [英] Duplicate Entry for ':app:transformClassesWithJarMergingForDebug'
问题描述
我正在从 Eclipse 导入我的项目,在构建 APK 时发现以下错误.
I am Importing my project from Eclipse , while building an APK i found following Error.
错误:任务执行失败
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/plus/PlusOneButton$OnPlusOneClickListener.class
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/plus/PlusOneButton$OnPlusOneClickListener.class
错误:任务:gruhini:transformClassesWithJarMergingForDebug"的执行失败.
Error:Execution failed for task ':gruhini:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/games/Game.class
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/games/Game.class
错误:任务:gruhini:transformClassesWithJarMergingForDebug"的执行失败.
Error:Execution failed for task ':gruhini:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/auth/GoogleAuthException.class
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/GoogleAuthException.class
错误:任务:gruhini:processDebugGoogleServices"的执行失败.
Error:Execution failed for task ':gruhini:processDebugGoogleServices'.
请通过更新 google-services 插件的版本来解决版本冲突(有关最新版本的信息可在 https://bintray.com/android/android-tools/com.google.gms.google-services/) 或更新 com 的版本.google.android.gms 到 9.0.0.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
我的 build.gradle:
my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/**'
}
defaultConfig {
applicationId "com.gruhini"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
incremental true
preDexLibraries false
//javaMaxHeapSize "1G" // 2g should be also OK
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':eclipseProject')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/google-play-services.jar')
compile files('libs/httpclient-4.1.jar')
compile files('libs/httpcore-4.1.jar')
compile files('libs/httpmime-4.1.jar')
compile files('libs/itextpdf-5.2.1.jar')
compile files('libs/mail.jar')
compile files('libs/mpandroidchartlibrary-1-7-4.jar')
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
}
推荐答案
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/plus/
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/plus/
问题
compile files('libs/google-play-services.jar') // Remove this line
compile 'com.google.android.gms:play-services:10.2.0' //10.0.1 or 9.6.0
两者都是一样的.调用其中之一.然后清理-重建并运行.
Both are same .Call one of them . Then Clean-Rebuild and Run .
试试这个 App Level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.gruhini"
minSdkVersion 15
targetSdkVersion 25
versionCode 12
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile project(':eclipseProject')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/httpclient-4.1.jar')
compile files('libs/httpcore-4.1.jar')
compile files('libs/httpmime-4.1.jar')
compile files('libs/itextpdf-5.2.1.jar')
compile files('libs/mail.jar')
compile files('libs/mpandroidchartlibrary-1-7-4.jar')
compile 'com.android.support:support-v4:25.1.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
}
项目级别 build.gradle
// 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.2.2' //2.2.3
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
}
这篇关于':app:transformClassesWithJarMergingForDebug' 的重复条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!