Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol AndroidSchedulers

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

like image 736
syfy Avatar asked Nov 19 '16 07:11

syfy


3 Answers

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'
like image 169
Maksim Ostrovidov Avatar answered Nov 03 '22 15:11

Maksim Ostrovidov


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

like image 8
Anuraag Patil Avatar answered Nov 03 '22 15:11

Anuraag Patil


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'
like image 5
DevPolarBear Avatar answered Nov 03 '22 15:11

DevPolarBear