【问题标题】:How to solve a Duplicate zip entry如何解决重复的 zip 条目
【发布时间】:2018-02-23 15:50:36
【问题描述】:

我遇到了这个问题:当我在 Android Studio 上运行我的项目时,它运行良好,但是当我尝试构建 APK(在 BUILD > BUILD Apk(s) 上)时,它会显示下一个错误:

错误:任务 ':app:transformClassesWithMultidexlistForDebug' 执行失败。 java.io.IOException: 无法写入 [/Users/sergio/Documents/ink/touch_android/app/build/intermediates/multi-dex/debug/componentClasses.jar] (无法读取 [/Users/sergio/. gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.3.3/63b77400b5f1cf83a81823562c48d3120ef5518e/jackson-databind-2.3.3.jar(;;;;;;**.class )] (重复的 zip 条目 [jackson-databind-2.3.3.jar:com/fasterxml/jackson/databind/JsonDeserializer$None.class]))

据我所知,这是由我在项目中发现的一个名为 JsonDeserializer 的重复类引起的

但我找不到从列出的每个 jar 中“取消链接”这些文件的方法。这是我的 gradle 文件。

应用插件:'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "---"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode -
        versionName "-"
        renderscriptTargetApi 22
        renderscriptSupportModeEnabled true
        multiDexEnabled true
        ndk {
            abiFilters "x86", "armeabi-v7a", "armeabi"
        }

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { resources.srcDirs = ['src/main/resources', 'src/main/java/includes'] } }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'

    }
}

dependencies
        {
            //compile fileTree(include: ['*.jar'], dir: 'libs')
            testCompile 'junit:junit:4.12'
            implementation files('libs/gson-2.5.jar')
            implementation files('libs/guava-18.0.jar')
            implementation files('libs/snmp6_1.jar')
            implementation 'com.crittercism:crittercism-android-agent:5.6.4'
            implementation files('libs/jackson-annotations-2.2.3.jar')
            implementation files('libs/jackson-databind-2.2.3.jar')
            implementation files('libs/httpmime-4.3.2.jar')
            implementation files('libs/httpcore-4.3.1.jar')
            implementation files('libs/commons-lang3-3.4.jar')
            implementation files('libs/commons-validator-1.4.0.jar')
            implementation files('libs/jackson-core-2.2.3.jar')
            implementation files('libs/commons-net-3.1.jar')
            implementation files('libs/ZSDK_ANDROID_API.jar')
            implementation files('libs/opencsv-2.2.jar')
            implementation files('libs/commons-io-2.2.jar')
            implementation files('libs/mrzjniInterfaceJar.jar')
            implementation 'com.kyleduo.switchbutton:library:1.4.1'
            implementation 'com.github.nkzawa:socket.io-client:0.3.0'
            implementation 'fr.tvbarthel.blurdialogfragment:lib:2.2.0'
            implementation 'com.android.support:multidex:1.0.1'
            implementation('de.keyboardsurfer.android.widget:crouton:1.8.5@aar')
            implementation 'com.android.support:appcompat-v7:23.4.0'
            implementation 'com.android.support.constraint:constraint-layout:1.0.2'
            implementation 'com.android.support:design:23.4.0'
            implementation files('libs/cw-deviceapi20171026.jar')
            implementation 'org.jmrtd:jmrtd:0.5.5'
            implementation 'net.sf.scuba:scuba-sc-android:0.0.9'
            implementation 'com.madgag.spongycastle:prov:1.54.0.0'
            implementation 'edu.ucar:jj2000:5.2'
            implementation 'com.github.mhshams:jnbis:1.1.0'
            implementation files('libs/BrotherPrintLibrary.jar')
            implementation files('libs/MobilePrintLib.jar')
        }

【问题讨论】:

    标签: java android


    【解决方案1】:

    尝试删除此implementation

    implementation files('libs/jackson-core-2.2.3.jar')
    

    然后做

    Build > Clean Project
    

    【讨论】:

      【解决方案2】:

      在您添加杰克逊依赖项的模块中,排除已经在另一个库中的类。否则,将其从其他库中排除并保留在 jackson 上。

      【讨论】:

      • 请你给我看一个例子来说明这是怎么做的?我迷路了
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-13
      • 1970-01-01
      • 1970-01-01
      • 2018-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多