在APK META_INF / NOTICE中复制的重复文件

时间:2014-05-18 18:59:30

标签: android gradle android-studio android-gradle

我正在使用android studio版本0.5.8

我正在使用httpclient-android和httpmime将帖子数据发送到http网址。

我的build.gradle文件:

apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
     }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'org.apache.commons:commons-lang3:3.3.2'
    compile 'org.apache.httpcomponents:httpclient-android:4.3.3'
    compile 'org.apache.httpcomponents:httpmime:4.3.3'
}

我收到以下错误

Error:Execution failed for task ':myalcoholist:packageDebug'.
> Duplicate files copied in APK META-INF/NOTICE
File 1: /home/ufk/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.3.3/e02368d7b56c0c376f227378a4f77de62864d020/httpmime-4.3.3.jar
File 2: /home/ufk/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.3.3/e02368d7b56c0c376f227378a4f77de62864d020/httpmime-4.3.3.jar

我尝试删除.grandle目录并同步grandle,但我仍然遇到同样的错误。

任何想法?

1 个答案:

答案 0 :(得分:5)

添加:

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

如果您再收到这些错误,只需将其添加到单独的行中即可。