0

尽管升级了依赖项,但我无法将此方法转换为 RxJava3

fun setSearchField(searchField: EditText) {
        searchDisposable = searchField.afterTextChangeEvents()
            .skipInitialValue()
            .debounce(400, TimeUnit.MILLISECONDS)
            .map { it.editable()?.toString() ?: "" }
            .distinctUntilChanged()
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(::onSearchQueryUpdated)
    }

类型不匹配。必需:io.reactivex.rxjava3.disposables.Disposable?找到:io.reactivex.disposables.Disposable!

    def retrofit_version = '2.9.0'
    implementation "io.reactivex.rxjava3:rxjava:3.0.4"
    implementation "io.reactivex.rxjava3:rxkotlin:3.0.0"
    implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
    implementation "com.jakewharton.rxbinding3:rxbinding:3.1.0"
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
    implementation "com.github.akarnokd:rxjava3-retrofit-adapter:3.0.0"
    implementation "com.squareup.okhttp3:logging-interceptor:4.7.2"

我应该如何准确地从 RxJava2 中清理项目?

我试过无效缓存/重启:什么也没发生。

在此处输入图像描述

4

1 回答 1

3

依赖: ./gradlew :dependencies

implementationDependenciesMetadata
+--- io.reactivex.rxjava3:rxjava:3.0.4
|    \--- org.reactivestreams:reactive-streams:1.0.3
+--- io.reactivex.rxjava3:rxkotlin:3.0.0
|    \--- io.reactivex.rxjava3:rxjava:3.0.0 -> 3.0.4 (*)
+--- io.reactivex.rxjava3:rxandroid:3.0.0
|    \--- io.reactivex.rxjava3:rxjava:3.0.0 -> 3.0.4 (*)
+--- com.jakewharton.rxbinding3:rxbinding:3.1.0
|    +--- androidx.annotation:annotation:1.0.0 FAILED
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.41 -> 1.3.71
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.71
|    |    \--- org.jetbrains:annotations:13.0
|    +--- io.reactivex.rxjava2:rxjava:2.2.10
|    |    \--- org.reactivestreams:reactive-streams:1.0.2 -> 1.0.3
|    \--- io.reactivex.rxjava2:rxandroid:2.1.1
|         \--- io.reactivex.rxjava2:rxjava:2.2.6 -> 2.2.10 (*)

你看, rxbinding3 有一个传递依赖

|    +--- io.reactivex.rxjava2:rxjava:2.2.10

覆盖 RxJava3

解决方案:

implementation 'com.jakewharton.rxbinding4:rxbinding:4.0.0'
于 2020-06-08T11:07:30.163 回答