Cannot resolve symbol AndroidSchedulers

syfy picture syfy · Nov 19, 2016 · Viewed 14.9k times · Source

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

Answer

Maksim Ostrovidov picture Maksim Ostrovidov · Nov 19, 2016

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'