android – 如何解决APK META-INF / rxjava.properties中复制的重复文件
作者:互联网
我在我的android应用程序上使用rxjava和rxvolley.当我尝试运行它时,我收到此错误
Execution failed for task ':testapp:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties
File1: C:\Users\Daniel\.gradle\caches\modules-2\files-2.1\io.reactivex\rxjava\1.1.0\748f0546d5c3c27f1aef07270ffea0c45f0c42a4\rxjava-1.1.0.jar
File2: C:\Users\Daniel\.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava2\rxjava\2.0.3\d2f725668bd22e21170381b23f8fbdf72c69d886\rxjava-2.0.3.jar
我有这样的exclude.gradle文件
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/rxjava.PROPERTIES'
exclude 'META-INF/RXJAVA.properties'
exclude 'META-INF/RXJAVA.PROPERTIES'
exclude 'META-INF/rxjava'
exclude 'META-INF/RXJAVA'
}
lintOptions {
abortOnError false
}
}
我该如何解决这个问题?
解决方法:
我有同样的问题.我修复它的方法是在app gradle中添加packagingOptions,如Duplicated file rxjava.properties中所述
android {
defaultConfig {
}
buildTypes {
}
packagingOptions{
exclude 'META-INF/rxjava.properties'
}
}
标签:android,android-gradle,rx-java,rx-android 来源: https://codeday.me/bug/20191001/1839601.html