Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using rxjava and rxvolley on my android aplication. When I try to run it I get this error

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:UsersDaniel.gradlecachesmodules-2files-2.1io.reactivex
xjava1.1.0748f0546d5c3c27f1aef07270ffea0c45f0c42a4
xjava-1.1.0.jar
            File2: C:UsersDaniel.gradlecachesmodules-2files-2.1io.reactivex.rxjava2
xjava2.0.3d2f725668bd22e21170381b23f8fbdf72c69d886
xjava-2.0.3.jar

I have a exclude.gradle file like this

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

How can I fix this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
960 views
Welcome To Ask or Share your Answers For Others

1 Answer

I had the same problem. The way I fixed it is adding the packagingOptions in app gradle as described in Duplicated file rxjava.properties

android {

    defaultConfig {
    }
    buildTypes {
    }
    packagingOptions{
        exclude 'META-INF/rxjava.properties'
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...