Android Studio Gradle构建错误 - Joda时间

时间:2015-08-11 08:04:25

标签: android android-studio gradle jodatime apache-commons-io

我将最新的Joda Time jar添加到我的libs文件夹中并添加了库。在尝试运行时,我收到以下错误:

Error:Execution failed for task ':Selfies:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
    File 1: C:\Users\Dominic\Desktop\selfieapp\Selfies\Selfies\libs\commons-io-2.4.jar
    File 2: C:\Users\Dominic\Desktop\selfieapp\Selfies\Selfies\libs\joda-time-2.8.1.jar

不太清楚这意味着什么以及如何解决它。任何帮助都会很棒!

2 个答案:

答案 0 :(得分:2)

像这样更新你build.gradle

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

答案 1 :(得分:0)

您可以在build.gradle中使用packagingOptions排除此文件 - 但您还应该查看joda-time-android或更好https://github.com/JakeWharton/ThreeTenABP