我在构建项目时在Android Studio中获得异常
错误:任务执行失败 ':应用程序:transformClassesWithJarMergingForDebug&#39 ;. com.android.build.api.transform.TransformException: java.util.zip.ZipException:重复条目: 机器人/支撑/ V4 /视图/ LayoutInflaterFactory.class
我的gradle文件是 -
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.amt.partnerapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
dexOptions {
preDexLibraries = false
}
}
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:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.android.support:design:23.4.0'
testCompile 'junit:junit:4.12'
compile files('libs/activation.jar')
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.android.support:multidex:1.0.0'
compile "com.android.support:support-v4:23.4.0"
}
答案 0 :(得分:1)
com.google.android.gms:play-services:9.2.0
取决于您提供的不同版本的支持库。你可以查一下here
尝试从中排除支持依赖项。像那样:
compile ('com.google.android.gms:play-services:9.2.0') {
exclude group: 'com.android.support', module: 'support-v4'
}