android - APK META-INF/maven/com.squareup/otto/pom.xml 中复制的重复文件

标签 android android-studio gradle

当我尝试运行我的应用程序时遇到下面提到的错误。

错误:任务“:app:transformResourcesWithMergeJavaResForAmazonCheezCoverage”执行失败。

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup/otto/pom.xml File1: /Users/afourtest/.gradle/caches/modules-2/files-2.1/com.crashlytics.android/crashlytics/1.1.13/e821eafa1bf489a26bdb71f95078c26785b37a1/crashlytics-1.1.13.jar File2: /Users/afourtest/.gradle/caches/modules-2/files-2.1/com.squareup/otto/1.3.7/69d90fd7fb70e54746e26c10454c220e40a775ce/otto-1.3.7.jar

我的应用程序 build.gradle 是 here

最佳答案

添加到build.gradle:

android {
...
    packagingOptions {
         exclude 'META-INF/maven/com.squareup/otto/pom.xml'
}

此外,您可以使用 pickFirst

而不是 exclude

关于android - APK META-INF/maven/com.squareup/otto/pom.xml 中复制的重复文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34649615/

相关文章:

java - 制作包含测试文件的 Gradle 项目

每个工具链的 Gradle native 库

android - 获取异常作为失败保存状态 : active Fragment has cleared index: -1 when I am pressing home button of android device

android - 一次使用半滑动viewpager android的两个 ListView

android - 如何提取一些单元测试来分离 gradle 测试任务?

java - 如何使用 android studio 以编程方式记录 Android 设备的所有入站和出站连接

c# - 为 Unity Mobile App 显示 Android Date Picker DIALOGUE

android - AMQP 或 MQTT 我可以选择哪个?

android-studio - 如何单击单击后具有其自己的StatelessWidget类的开关?

java - 构建失败,出现异常 react native