错误 :: 打包 APK 时出现重复文件

Error :: duplicate files during packaging of APK(错误 :: 打包 APK 时出现重复文件)

本文介绍了错误 :: 打包 APK 时出现重复文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android 工作室.我在应用程序运行期间遇到这种错误.

Android Studio. I'm getting this kind of error during application run.

错误:任务 ':app:packageDebug' 执行失败.APK META-INF/notice.txt 中复制的重复文件

build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

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

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

dependencies {
    compile 'com.android.support:appcompat-v7:19.0.1'
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
    compile 'com.octo.android.robospice:robospice:1.4.11'
    compile 'com.octo.android.robospice:robospice-spring-android:1.4.11'
}

我该如何解决这个错误?

How can I fix this error?

已编辑

这些排除选项解决了我的问题:

These exclude options solved my problem:

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'
    }

推荐答案

我认为字符串比较是区分大小写的.尝试使用 exclude 'META-INF/notice.txt'

I think the string comparison is case sensitive. try with exclude 'META-INF/notice.txt'

这篇关于错误 :: 打包 APK 时出现重复文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:错误 :: 打包 APK 时出现重复文件

基础教程推荐