1. adapter-rxjava:2.1.0 引入冲突

1
2
3
4
5
6
//报错
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: /Users/winkyqin/.gradle/caches/modules-2/files-2.1/io.reactivex.rxjava2/rxjava/2.0.4/cbcf91e47e43607fb628b11b3571f212f11a6f84/rxjava-2.0.4.jar
File2: /Users/winkyqin/.gradle/caches/modules-2/files-2.1/io.reactivex/rxjava/1.1.5/ece7b5d0870e66d8226dab6dcf47a2b12afff061/rxjava-1.1.5.jar

报错原因 参见 http://blog.csdn.net/bingducaijun/article/details/53584449
引用库版本导致不支持

1
2
3
4
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
//上库可以支持到rxjava2.X
//compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
//retrofit现在只支持到rxjava1.XX