java – Cannot resolve symbol AndroidSchedulers-ThrowExceptions

Exception or error:

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

How to solve:

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'

###

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

###

def rxJavaVersion = '2.1.1'

//Add to dependencies the following libraries

dependencies {

  implementation "io.reactivex.rxjava2:rxandroid:$rxJavaVersion"

  implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"

}

###

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'

@canerkaseler

Leave a Reply

Your email address will not be published. Required fields are marked *