Android Studio 1.0.1在APK META-INF / DEPENDENCIES中复制的重复文件

时间:2014-12-15 22:01:07

标签: java android gradle android-studio

我安装了Android Studio版本1.0.1,并试图将我的项目从eclipse导入到它,它给了我以下错误:

 Error:Execution failed for task ':app:packageDebug'.
 Duplicate files copied in APK META-INF/DEPENDENCIES
 File 1: E:\app3\app\libs\httpmime-4.3.jar
 File 2: E:\app3\app\libs\httpmime-4.3.jar``

我尝试使用转换jars选项导入我的项目并将其转换为gradle并且不转换它们 我经常搜索并在线尝试解决方案,但也没有工作 这是我的项目的build.gradle

apply plugin: 'com.android.application'

android {     compileSdkVersion 20     buildToolsVersion" 20.0.0"

defaultConfig {
    applicationId "com.FluoraPin.androidApp"
    minSdkVersion 14
    targetSdkVersion 21
}

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

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

dependencies {
    compile project(':beyondAR_Framework')
    compile project(':facebookSDK')
    compile project(':volley')
    compile 'com.android.support:support-v4:20.0.0'
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile files('libs/commons-logging-1.1.3.jar')
    compile files('libs/httpclient-4.3.6.jar')
    compile files('libs/httpclient-cache-4.3.6.jar')
    compile files('libs/httpcore-4.3.3.jar')
    compile files('libs/httpmime-4.3.jar')
    compile files('libs/picasso-2.3.4.jar')
    compile files('libs/retrofit-1.8.0.jar')
}

2 个答案:

答案 0 :(得分:12)

添加

android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }
}

应该解决你的问题。

答案 1 :(得分:0)

您在依赖项中有重复:

compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpclient-cache-4.3.6.jar')
这些中的

类文件是相同的