首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android Gradle构建依赖关系错误

Android Gradle构建依赖关系错误
EN

Stack Overflow用户
提问于 2016-02-18 15:33:57
回答 1查看 641关注 0票数 0

我在构建我的android项目时遇到了一个错误:

Error:java.util.zip.ZipException:重复条目:javax/批注/CheckForNull.class

这个类包含在and 305-1.3.9.jar和appengine-端点-deps-1.9.18.jar中。

我试图排除jsr305库,但没有帮助。请帮帮我。

我的模块build.gradle文件:

代码语言:javascript
复制
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文件:

代码语言:javascript
复制
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')
}

我的依赖树:

代码语言:javascript
复制
_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 (*)
EN

回答 1

Stack Overflow用户

发布于 2016-02-19 21:41:07

固定于:

代码语言:javascript
复制
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'
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35485716

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档