androidstudio HTTPCore version.properties中的重复文件异常

时间:2016-12-23 06:48:36

标签: android android-studio gradle

在android studio中有项目,我在该项目中使用了几个依赖项,我的gradle文件看起来像这样

defaultConfig {
    applicationId "com.omgproductionsinc.panicsosplus"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':FacebookSDK')
compile files('libs/httpclient-4.3.5.jar')
compile files('libs/httpclient-cache-4.3.5.jar')
compile (files('libs/httpcore-4.3.3.jar'))/*{
            exclude "org/apache/http/version.properties"
 }*/
compile files('libs/httpmime-4.3.5.jar')
compile files('libs/splunk-mint-4.0.7.jar')
compile (files('libs/twitpic4j.jar'))
compile files(('libs/twitter4j-core-4.0.1.jar'))
compile files(('libs/sendgrid-0.1.2-jar.jar'))
//compile files('libs/org.apache.http.legacy.jar')
compile ('oauth.signpost:signpost-commonshttp4:1.2.1.2')
compile ('oauth.signpost:signpost-core:1.2.1.2')
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.google.android.gms:play-services:5.0.89'
//compile 'org.lucee:httpcomponents-httpcore:4.4.4'

}

我像

一样异常
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/apache/http/version.properties
Error:com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/apache/http/version.properties
Error:com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/apache/http/version.properties

我已经浏览了很多问题,但没有一个解决方案对我有用,请帮我解决这个问题

1 个答案:

答案 0 :(得分:2)

你要

  

错误:com.android.build.api.transform.TransformException:   com.android.builder.packaging.DuplicateFileException:重复文件   复制到APK org / apache / http / version.properties中   错误:com.android.builder.packaging.DuplicateFileException:重复   在APK org / apache / http / version.properties

中复制的文件

您应该启用 packagingOptions

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

并设置multiDexEnabled true 然后清理 - 重建您的项目并 RUN