I have an Android application which relies on RxAndroid (based on RxJava2). I've also added the RxAdnroidBle dependency which still uses RxJava1.
During compilation I had the following 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: /home/eddy/.gradle/caches/modules-2/files-2.1/io.reactivex.rxjava2/rxjava/2.1.0/2fdf84dedcaaeabb9d70cde9dbb8aad4eccb80a1/rxjava-2.1.0.jar
File2: /home/eddy/.gradle/caches/modules-2/files-2.1/io.reactivex/rxjava/1.3.0/af000bec2036a2a9d07197c4b03b8966bfc60b03/rxjava-1.3.0.jar
Which I solved by adding the following block to build.gradle
:
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
I seems that everything works fine. But just to make sure - having both RxJava 1 & 2 libraries as dependencies may cause any problems?
Thanks,
They live in different packages, so you can use them together
From oficial documentation
To allow having RxJava 1.x and RxJava 2.x side-by-side, RxJava 2.x is under the maven coordinates io.reactivex.rxjava2:rxjava:2.x.y and classes are accessible below io.reactivex
Here we can see they can be side-by-side in one project
https://github.com/ReactiveX/RxJava/wiki/What%27s-different-in-2.0