我收到重复条目的错误:Java / annotation / check for null。我试图解决这个问题但尚未解决。我已经修复了获取和发现谷歌的所有问题以及与之相关但未解决的所有问题。 帮帮我做什么
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:javax / annotation / CheckForNull.class
这是build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion "Google Inc.:Google APIs:23"
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.androidhive.googleplacesandmaps"
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
exclude 'error_prone/Annotations.gwt.xml'
exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
pickFirst 'javax/annotation/**' // add this
exclude 'META-INF/LICENSE'
}
}
dependencies {
//noinspection GradleCompatible
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.code.gson:gson:2.1'
compile 'com.google.guava:guava:11.0.1'
compile 'com.google.protobuf:protobuf-java:2.2.0'
compile files('libs/google-api-client-1.10.3-beta.jar')
// compile files('libs/google-api-client-android2-1.10.3-beta.jar')
compile files('libs/google-http-client-1.10.3-beta.jar')
compile files('libs/google-http-client-android2-1.10.3-beta.jar')
compile files('libs/google-oauth-client-1.10.1-beta.jar')
compile files('libs/jackson-core-asl-1.9.4.jar')
compile files('libs/jsr305-1.3.9.jar')
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile ('com.android.support:design:23.0.1'){
exclude group: 'com.android.support'
}
compile ('com.google.android.gms:play-services-plus:9.0.0'){
exclude group: 'com.google.guava'
}
}
答案 0 :(得分:-1)
您可以在build.gradle中使用此方法解决重复错误:
android {
...
packagingOptions {
pickFirst 'javax/annotation/**' // add this
}
}