Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/annotation/CheckForNull.class
下面是我的应用程序级 gradle 文件。我尝试删除 appcompat,支持 v4,但没有帮助。该应用程序运行良好,否则只有当我尝试生成签名的 apk 时才会收到错误消息。
buildsript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.aubergine.resqv1"
minSdkVersion 16
targetSdkVersion 25
versionCode 10109
versionName "1.2.0"
// Enabling multidex support.
multiDexEnabled true
// Flag to tell aapt to keep the attribute ids around
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
buildTypes {
release {
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
//For Mint bug reporter
maven { url "https://mint.splunk.com/gradle/" }
//For bug report and crash report
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://maven.localytics.com/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// libs for Material design
// libs for dependency Injection
// libs for Common font for Application
//libs for calling api using Retrofit
//For calling api using retrofit
//For Mint bug reporter
//For graph
//libs for MaterialDesign EditText
//For Circle Image
//for universal image loader
//For Number Picker in Estimated Time https://github.com/KasualBusiness/MaterialNumberPicker
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
transitive = true;
}
compile('com.digits.sdk.android:digits:2.0.5@aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.5'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'biz.kasual:materialnumberpicker:1.2.0'
compile 'com.google.android.gms:play-services-analytics:10.0.1'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
compile 'com.shawnlin:number-picker:2.4.1'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.localytics.android:library:4.2.+'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
此外,还有两个 CheckForNull 类,实际上在 jsr-305 中有重复的类。截图:
这个问题的明智解决方案是什么?