android – 在应用程序构建期间复制文件(后gradle更新)

前端之家收集整理的这篇文章主要介绍了android – 在应用程序构建期间复制文件(后gradle更新)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
由于更新 Android Studio和gradle,调试和普通版本会给我重复错误
: duplicate files during packaging of APK /Users/Stu/projects/****/build/apk/*****-debug-unaligned.apk

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

Duplicate files copied in APK Meta-INF/ASL2.0
File 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
File 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.+'
}

解决方法

看起来Meta-INF / ASL2.0文件正在被复制.尝试将此添加到您的包装选项:
exclude 'Meta-INF/ASL2.0'`
原文链接:https://www.f2er.com/android/308661.html

猜你在找的Android相关文章