I'm using version 2.0.0 of RxJava, and it seems like I have no access to AndroidSchedulers
. I'm unable to get access to mainthread through RxJava
Cannot resolve symbol AndroidSchedulers
AndroidSchedulers
class is a part of RxAndroid
library. Add it to your app's build.gradle
:
before Gradle v3.0:
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
since Gradle v3.0:
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
I had same problem. You cannot call AndroidSchedulers with RxJava3. I think this is a bug. They need to fix it.
You need to add they on your dependencies of gradle:
//RxAndroid
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
//RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
Go back to Old Versions:
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
Then to the Newer Version:
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.1'
Sounds Weird but it works
This is perfectly working, thanks a lot. This is more meaningful and helpful answer –
Gaziantep
def rxJavaVersion = '2.1.1'
//Add to dependencies the following libraries
dependencies {
implementation "io.reactivex.rxjava2:rxandroid:$rxJavaVersion"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
}
While this code may provide a solution to the question, it's better to add context as to why/how it works. This can help future users learn, and apply that knowledge to their own code. You are also likely to have positive feedback from users in the form of upvotes, when the code is explained. –
Warily
Now you can use RX 3 by adding the below dependency
implementation "io.reactivex.rxjava3:rxandroid:$version"
get the version from this link : https://github.com/ReactiveX/RxAndroid
io.reactivex.rxjava3:rxandroid:3.0.0
–
Liew © 2022 - 2024 — McMap. All rights reserved.
implementation "io.reactivex.rxjava3:rxjava:3.1.1" implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
– Gomar