【问题标题】:Android app giving multidex run time error duplicate entry: (Can't read (Duplicate zip entry ))Android 应用程序给出 multidex 运行时错误重复条目:(无法读取(重复的 zip 条目))
【发布时间】:2018-03-21 22:26:32
【问题描述】:

运行应用程序时出现以下错误。我无法确定我为什么会遇到这个问题。

错误:任务执行失败 ':app:transformClassesWithMultidexlistForDebug'.

java.io.IOException: 无法写入 [GooglePlaces\app\build\intermediates\multi-dex\debug\componentClasses.jar] (无法读取 [C:\Program Files\Android\Android Studio\gradle\m2repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar(;;;;;;**.class)] (重复的 zip 条目 [jsr305-1.3.9.jar:javax/annotation/CheckForNull.class]))

这是我的 gradle 代码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion "26.0.2"
    useLibrary  'org.apache.http.legacy'
    defaultConfig {
        applicationId ""
        minSdkVersion 15
        targetSdkVersion 21
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:23.0.0'
    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')
}

如果可以的话,请帮助我,谢谢。

【问题讨论】:

    标签: java android gradle android-gradle-plugin build.gradle


    【解决方案1】:

    这是因为 guava library 具有相同的依赖关系

    <dependency>
       <groupId>com.google.code.findbugs</groupId>
       <artifactId>jsr305</artifactId>
       <version>1.3.9</version>
    </dependency>
    

    删除这一行:

    compile files('libs/jsr305-1.3.9.jar')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多