Error:Execution failed for task ‘:app:transformResourcesWithMergeJavaResForBetaNewApiDebug’.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files
copied in APK META-INF/rxjava.properties File1:
C:\Users\Gaket.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava2\rxjava\2.0.2\cfccdd18cdfbe7b4773d42c9f3512eeafbe5cbf9\rxjava-2.0.2.jar
File2:
C:\Users\Gaket.gradle\caches\modules-2\files-2.1\io.reactivex\rxjava\1.1.5\ece7b5d0870e66d8226dab6dcf47a2b12afff061\rxjava-1.1.5.jar
我看到RxJava存在一些问题(我想尝试RxJava 2,在这里我看到RxJava 1和RxJava 2).在添加所有依赖项后立即出现问题,我们在主应用程序中不使用RxJava.
更新:
正如我在下面提到的,我检查了三个主题(你可以在下面看到它).这个问题:possible duplicate类似于我在下面提到的那个:this one.他们都有解决方法,没有考虑我在答案中强调的真正问题.答案是“目前还没有从Retrofit 2到RxJava 2的生产就绪适配器”(详情见下面的答案).
我检查了几个主题:first是一个具体问题的具体解决方案,second谈论rxbindings,但我不使用它们,其他一些也没有解决我的问题或看起来像完全解决方法this one.我试图google“rxjava 2和改造2“但没有找到解决方案.
这是库的build.gradle:
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
compile 'io.reactivex.rxjava2:rxjava:2.0.2'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile "com.makeramen:roundedimageview:1.3.0"
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
provided 'javax.annotation:jsr250-api:1.0'
compile 'com.jakewharton:butterknife:8.4.0'
testCompile 'junit:junit:4.12'
}
问题是:
为什么会出现这个问题以及处理它的正确方法是什么?