应用程序构建期间重复文件(gradle更新后)

时间:2014-01-13 19:45:28

标签: android

由于更新Android Studio和gradle,调试和普通版本会给我重复错误:

: duplicate files during packaging of APK /Users/Stu/projects/****/build/apk/*****-debug-unaligned.apk

Execution failed for task ':*****:packageDebug'.
  

在APK META-INF / ASL2.0中复制的重复文件       文件1:/Users/Stu/.gradle/caches/modules-2/files-2.1/org.codehaus.jackson/jackson-mapper-asl/1.9.11/45d70862fa016993193075a1e8e32a01dcf438e8/jackson-mapper-asl-1.9.11.jar       文件2:/Users/Stu/.gradle/caches/modules-2/files-2.1/org.codehaus.jackson/jackson-mapper-asl/1.9.11/45d70862fa016993193075a1e8e32a01dcf438e8/jackson-mapper-asl-1.9.11.jar

我已将建议的修补程序添加到build.gradle(Duplicate files copied (Android Studio 0.4.0)):

buildscript {
    repositories {
        maven {
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
            url 'http://dl.bintray.com/populov/maven'
        }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
        classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.+'
    }
}
apply plugin: 'android'
apply plugin: 'android-test'

configurations {
    unitTestCompile.extendsFrom runtime
    unitTestRuntime.extendsFrom unitTestCompile
}


repositories {
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
        url 'http://dl.bintray.com/populov/maven'
    }
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 19
    }

    sourceSets {
        instrumentTest.setRoot('src/test')
    }

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

dependencies {
    compile ('com.octo.android.robospice:robospice-spring-android:1.4.7')
            {
                exclude module: 'support-v4'
            }
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.+'
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.viewpagerindicator:library:2.4.1@aar'
    compile 'com.google.android.gms:play-services:4.0.30'
    testCompile 'junit:junit:4.10'
    testCompile 'org.robolectric:robolectric:2.+'
    testCompile 'com.squareup:fest-android:1.0.+'
    instrumentTestCompile 'junit:junit:4.10'
    instrumentTestCompile 'org.robolectric:robolectric:2.+'
    instrumentTestCompile 'com.squareup:fest-android:1.0.+'
}

1 个答案:

答案 0 :(得分:8)

看起来META-INF/ASL2.0文件正在重复。尝试将其添加到packagingOptions

exclude 'META-INF/ASL2.0'`