Search code examples
javaandroidrx-javarx-java2

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


Solution

  • 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'