android - 无法解析 RXJava 依赖项

标签 android android-gradle-plugin rx-java rx-android

我正在尝试运行以下项目:https://github.com/amitshekhariitbhu/RxJava2-Android-Samples

依赖项是:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'io.reactivex.rxjava2:rxjava:2.0.0'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.0'
}

但是我得到以下错误。

Error:(26, 13) Failed to resolve: io.reactivex.rxjava2:rxandroid:2.0.0 Show in File
Show in Project Structure dialog

我做错了什么吗?

最佳答案

我在使用 RxKotlin 时遇到了类似的问题,IDE 在离线模式下使用了 Gradle。 (设置 -> Gradle -> 关闭离线模式)。

此外,我建议检查您的版本是否正确 here .

它帮助我设置了 RxKotlin ,因为只有 x.y.z. 版本。

工作梯度导入:

compile 'io.reactivex:rxkotlin:2.0.0-RC1'

关于android - 无法解析 RXJava 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41045066/

相关文章:

android - 通知到达时不会出现提醒通知

android - Android Studio 中的 Kotlin 构建失败

java - DisposableObserver 与(常规)观察者

android - 不使用 Observable.create 创建 Observable

android - 如何在多个项目中重用单个类,对功能进行微小修改?

android - 在 android 中处理动态数据类型

编辑文本问题中的Android MVVM数据绑定(bind)设置错误

android - Gradle 构建工具找不到 play-services-tasks.aar?为什么?

android - 找不到 Gradle DSL 方法'compile()

android - 在 Subject 的 onNext 上触发 Observable 并分享结果