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

sasha199568
  • 1,143
  • 1
  • 11
  • 33

2 Answers2

5

Use the proper version of the adapter.

compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
Emanuel
  • 8,027
  • 2
  • 37
  • 56
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.

Rahul Sharma
  • 12,515
  • 6
  • 21
  • 30