2

Here are the dependencies

compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'io.reactivex.rxjava2:rxjava:2.0.7'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.retrofit2:adapter-rxjava:2.2.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'

When I try to run the app I get this error

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties File1: C:\Users\abondarenco.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava2\rxjava\2.0.7\21734c0092a5d3c3ec99510e50c1ff76bdf0c65a\rxjava-2.0.7.jar File2: C:\Users\abondarenco.gradle\caches\modules-2\files-2.1\io.reactivex\rxjava\1.2.0\42bfaf64c94f3848ebf5cf1c2ea4ec9d1b3ac6c8\rxjava-1.2.0.jar

I tried to run app without adapter-rxjava and it works, but when I add the adapter it says that there are duplicate files, it downloads RxJava 1...

2

2 Answers 2

5

Use the proper version of the adapter.

compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
Sign up to request clarification or add additional context in comments.

Comments

0

I know its too late to answer on this thread but I faced the same issue recently and able to resolve this by updating module level build.gradle file.

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

Hope it will help some people out from the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.