当我解决最常见的问题时,我遇到了这个问题 错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / v4 / graphics / BitmapCompat.class
我的gradle class ::
apply plugin: 'com.android.application'
android {
//compileSdkVersion 25
//buildToolsVersion "25.0.0"
compileSdkVersion 21
buildToolsVersion '24.0.3'
defaultConfig {
applicationId "com.scrollcoupons.com.kada"
// minSdkVersion 19
// targetSdkVersion 25
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //important
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.github.Yalantis:GuillotineMenu-Android:1.2'
//compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.jakewharton:butterknife:8.8.1'
//compile 'com.android.support:design:25.3.1'
// testCompile 'junit:junit:4.12'
//annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//add external library
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
}
答案 0 :(得分:1)
你应该排除重复的文件
android {
//compileSdkVersion 25
//buildToolsVersion "25.0.0"
compileSdkVersion 21
buildToolsVersion '24.0.3'
defaultConfig {
applicationId "com.scrollcoupons.com.kada"
// minSdkVersion 19
// targetSdkVersion 25
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //important
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
-----> configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.android.support', module: 'support-annotations'
}
}
答案 1 :(得分:0)
步骤1:在这种情况下,主提示是android / support / v4 / graphics / BitmapCompat.class
第2步:搜索类,在您的情况下," BitmapCompat.class" (在AndroidStudio中只需按Windows上的Ctrl + N或Mac上的CMD-O)
步骤3:查看哪个jar包含它 - Android Studio将在弹出窗口中编写它。
第4步:从所有版本中排除它,
例如:
com.android.support:support-v4:_____
compile('your_conflicted_dependency')
{
exclude module: 'support-v4'
}
答案 2 :(得分:0)
在configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.android.support', module: 'support-annotations'
}
{{1}}