androidrx-java2rx-kotlinrx-bindingrx-java3

Can't migrate accurately from RxJava2 to RxJava3


I can't convert this method to RxJava3 despite having upgraded the dependencies

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

Type mismatch. Required: io.reactivex.rxjava3.disposables.Disposable? Found: 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"

How should I accurately clean the project from RxJava2?

I tried Invalidate caches/Restart: nothing happened.

enter image description here


Solution

  • Dependencies: ./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 (*)
    

    You see, that rxbinding3 has a transitive dependency to

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

    Which overwrites RxJava3

    Solution:

    implementation 'com.jakewharton.rxbinding4:rxbinding:4.0.0'