构建我的android项目时遇到错误:
错误:java.util.zip.ZipException:重复条目:javax / annotation / CheckForNull.class
此类包含在jsr305-1.3.9.jar和appengine-endpoints-deps-1.9.18.jar中。
我试图排除jsr305库,但它没有帮助。请帮帮我。
我的模块build.gradle文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
compile ('com.google.appengine:appengine-endpoints:1.9.18') {
exclude module: 'google-http-client'
exclude module: 'appengine-api-1.0-sdk'
}
compile ('com.google.appengine:appengine-endpoints-deps:1.9.18') {
exclude module: 'jsr305'
}
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
我的主build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.udacity.gradle.builditbigger"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
}
dependencies {
compile project(':libjokes')
compile project(':mylibrary')
compile project (':backend')
// Added for AdMob
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile project(path: ':backend', configuration: 'android-endpoints')
}
我的依赖树:
_releaseApk - ## Internal use, do not manually configure ##
+--- com.android.support:multidex:1.0.1
+--- project :libjokes
+--- project :mylibrary
| \--- com.android.support:appcompat-v7:23.1.1
| \--- com.android.support:support-v4:23.1.1
| \--- com.android.support:support-annotations:23.1.1
+--- project :backend
| +--- com.google.appengine:appengine-endpoints:1.9.18
| | \--- com.google.appengine:appengine-api-1.0-sdk:1.9.18
| +--- com.google.appengine:appengine-endpoints-deps:1.9.18
| \--- com.google.api-client:google-api-client-android:1.19.0
| +--- com.google.api-client:google-api-client:1.19.0
| | +--- com.google.oauth-client:google-oauth-client:1.19.0
| | | +--- com.google.http-client:google-http-client:1.19.0
| | | | \--- com.google.code.findbugs:jsr305:1.3.9
| | | \--- com.google.code.findbugs:jsr305:1.3.9
| | +--- com.google.http-client:google-http-client-jackson2:1.19.0
| | | +--- com.google.http-client:google-http-client:1.19.0 (*)
| | | \--- com.fasterxml.jackson.core:jackson-core:2.1.3
| | \--- com.google.guava:guava-jdk5:13.0
| \--- com.google.http-client:google-http-client-android:1.19.0
| \--- com.google.http-client:google-http-client:1.19.0 (*)
\--- com.google.android.gms:play-services-ads:8.4.0
\--- com.google.android.gms:play-services-basement:8.4.0
\--- com.android.support:support-v4:23.0.0 -> 23.1.1 (*)
答案 0 :(得分:0)
修正:
configurations {
all*.exclude module: 'jsr305'
}
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
compile('com.google.appengine:appengine-endpoints:1.9.18') {
exclude module: 'appengine-api-1.0-sdk'
}
compile('com.google.appengine:appengine-endpoints-deps:1.9.18') {
exclude module: 'google-http-client'
}
compile 'javax.servlet:servlet-api:2.5'
}