【问题标题】:Getting error like duplicate Duplicate files copied in APK META-INF/LICENSE出现错误,如在 APK META-INF/LICENSE 中复制的重复文件
【发布时间】:2017-05-25 18:34:55
【问题描述】:

请帮助我,我是 android studio 的新手,我正在尝试使用 MultiPartRequester 将图像文件发送到服务器,在 Eclipse 中它工作正常,但在 Android Studio 中我添加了依赖项

compile org.apache.httpcomponents:httpcore:4.2.4
compile org.apache.httpcomponents:httpmime:4.3

我收到了这个错误

Error:Execution failed for task app:transformResourcesWithMergeJavaResForDebug'. com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: C:\Users\active 36\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.3\11393498b38e9695d0850cac26fde5613ae268b9\httpcore-4.3.jar
File2: C:\Users\active 36\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.3\5b0002c5fb66867ca919be0fbd86de1cfaf76da7\httpmime-4.3.jar

分级:

compile 'com.android.support:multidex:1.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile 'log4j:log4j:1.2.17'
// compile 'de.mindpipe.android:android-logging-log4j:1.0.3'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: "$buildDir", include: 'native-libs.jar')
compile project(':wordPayLib')
compile project(':simple-crop-image-lib')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.+'
compile 'com.crittercism:crittercism-android-agent:+'
compile 'com.google.android.gms:play-services:10.0.+'
compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.firebase:firebase-messaging:10.0.0'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.googlecode.android-query:android-query:0.24.3'
compile 'com.squareup.picasso:picasso:2.5.2'

compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile "org.apache.httpcomponents:httpcore:4.2.4"
compile "org.apache.httpcomponents:httpmime:4.3"

请任何人帮我解决这个问题。谢谢。

【问题讨论】:

    标签: android file android-studio image-uploading


    【解决方案1】:

    试试

     packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    
    }
    

    然后清理重建并运行

    仅供参考

    你得到了

    DuplicateFileException: APK 中复制的文件重复

    确保相同的依赖项正在调用。

    评论

     compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
        compile "org.apache.httpcomponents:httpcore:4.2.4"
        compile "org.apache.httpcomponents:httpmime:4.3"
    

        compile group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
         compile 'org.apache.httpcomponents:httpmime:4.3.5'
    

    【讨论】:

      【解决方案2】:

      在您的 gradle 文件中,在 android 块中添加 packagingOptions

      android {
      
          packagingOptions {
          exclude 'META-INF/LICENSE'
          }
      }
      

      【讨论】:

      • compile 'com.android.support:multidex:1.0.1' compile fileTree(include: ['.jar'], dir: 'libs') compile fileTree(dir: 'libs ', include: ['.jar']) compile fileTree(dir: "$buildDir", include: 'native-libs.jar') compile project(':wordPayLib') compile project(':simple- crop-image-lib') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.0.+'
      • 编译 'com.crittercism:crittercism-android-agent:+' 编译 'com.google.android.gms:play-services:10.0.+' 编译 'com.github.rahatarmanahmed:circularprogressview: 2.5.0' 编译'com.mikhaellopez:circularimageview:3.0.2'
      • 编译 'com.facebook.android:facebook-android-sdk:4.+' 编译 'com.android.volley:volley:1.0.0' 编译 'com.google.firebase:firebase-消息传递:10.0.0' 编译 'com.google.firebase:firebase-auth:9.2.1' 编译 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http。客户端:4.1.2' 编译 'com.googlecode.android-query:android-query:0.24.3' 编译 'com.squareup.picasso:picasso:2.5.2' 编译 'com.skyfishjy.ripplebackground:library:1.0. 1'
      • 编译“org.apache.httpcomponents:httpcore:4.2.4”编译“org.apache.httpcomponents:httpmime:4.3”
      • @sunil not here ... 编辑您的问题并将其放在那里
      猜你喜欢
      • 2017-12-08
      • 1970-01-01
      • 2017-01-29
      • 2017-02-09
      • 2016-08-10
      • 2016-12-27
      • 2017-11-14
      • 1970-01-01
      相关资源
      最近更新 更多