将 RxPresso 添加到项目时出错

Error when adding RxPresso to project

我在尝试将 RxPresso(https://github.com/novoda/rxpresso/) 添加到我的项目时收到此错误消息:

Warning:Conflict with dependency 'io.reactivex:rxjava'. Resolved versions for app (1.1.9) and test app (1.0.14) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

我目前使用的是 rxjava 1.1.9。如何在我的项目中添加 RxPresso?

非常感谢

您可以明确地告诉 Gradle 要使用哪个版本,方法是添加到您的 build.gradle 下一个代码段

configurations.all {
    // check dependency tree with gradlew :app:dependencies

    // avoid wildcard '+' dependencies used at 3rd libraries forcing them to exact version
    resolutionStrategy.force "io.reactivex:rxjava:1.1.9"
}

为避免 RxJava 和 Android 支持库版本出现任何问题,请转到您的 app/build.gradle 文件并在 dependencies 部分粘贴:

androidTestCompile ('com.novoda:rxpresso:0.2.0') {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'io.reactivex'
}