无法从 RxJava2 准确迁移到 RxJava3
Can't migrate accurately from RxJava2 to RxJava3
尽管升级了依赖项,但我无法将此方法转换为 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准确清理项目?
我试过使无效caches/Restart:什么都没发生。
依赖项:./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'
尽管升级了依赖项,但我无法将此方法转换为 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准确清理项目?
我试过使无效caches/Restart:什么都没发生。
依赖项:./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'