0
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時纔會出現錯誤。無法生成簽名APK - 重複項:javax/annotation/CheckForNull.class
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:[email protected]') {
transitive = true;
}
compile('com.digits.sdk.android:digits:[email protected]') {
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。截圖:
這將是一個明智的解決這個問題?
在我看來,你的'build.gradle'中至少有兩個庫,它們都具有'javax'作爲它們的依賴(aka transitive dependency)。所以,你正在將兩個不同版本的'javax'庫導入到你的代碼庫中,這就是爲什麼你有兩個雙重類。只需查看所有依賴關係'./gradlew app:dependencies'並查找兩個依賴於'javax'的庫並排除其中一個依賴關係。 – azizbekian