Issue
I try to implement observeOn AndroidSchedulers.mainThread() But it always crash
if I remove this line it working fine
myObservable = Observable.fromArray(intArray);
myObservable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).
subscribeWith(getObserver());
Error Log
java.lang.BootstrapMethodError: Exception from call site #1 bootstrap method
at io.reactivex.rxjava3.android.schedulers.AndroidSchedulers.<clinit>(AndroidSchedulers.java:33)
at io.reactivex.rxjava3.android.schedulers.AndroidSchedulers.mainThread(AndroidSchedulers.java:44)
at com.example.rxjavasample.SecondActivity.onCreate(SecondActivity.java:38)
Gradle dependencies
implementation "io.reactivex.rxjava3:rxjava:3.0.4"
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
You probably have to set your project to Java 8 mode:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
yes its fixed
Most helpful comment
You probably have to set your project to Java 8 mode: