ReactiveX / RxAndroid

RxJava bindings for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IllegalAccessError: FlowableDoOnLifecycle: 2.2.3

otto-25 opened this issue · comments

App's Config:
minSdkVersion 21
targetSdkVersion 29

I am getting the following crash only for the release versions of my app in Firebase:

Illegal class access: 'io.reactivex.internal.operators.flowable.e$a' attempting to access 'io.reactivex.internal.functions.Functions$d' (declaration of 'io.reactivex.internal.operators.flowable.e$a' appears in base.apk!classes2.dex)

I get this crash on subscribe method call while trying to create a flowable for uploading image to the server in Android, i.e. :

compositeDisposable.add(createFlowable(accessToken, multipartBodyPart, imageUploadForAuditRequestBody)
.subscribeOn(schedulerProvider.io())
.debounce(200, TimeUnit.MILLISECONDS)
.observeOn(schedulerProvider.ui())
.doOnSubscribe { mvpView.showLoading("Uploading image...") }
.subscribe( // Crashing here
{
// do something
},
{ throwable: Throwable? ->
// do something
}
))

private fun createFlowable(accessToken: String, multipartBodyPart: MultipartBody.Part, imageUploadForAuditRequestBody: MutableMap<String, RequestBody>): Flowable {
return Flowable.create(
{ emitter: FlowableEmitter ->
try {
val response = RestClient.getRestClient().get().onFileUpload(
"Bearer " + accessToken,
imageUploadForAuditRequestBody, multipartBodyPart).blockingGet()
emitter.onNext(response)
} catch (e: Exception) {
Timber.e("Exception %s", e.localizedMessage)
emitter.tryOnError(e)
}
}, BackpressureStrategy.LATEST)
}

Please refer the following stack trace:
Fatal Exception: java.lang.IllegalAccessError: Illegal class access: 'io.reactivex.internal.operators.flowable.e$a' attempting to access 'io.reactivex.internal.functions.Functions$d' (declaration of 'io.reactivex.internal.operators.flowable.e$a' appears in base.apk!classes2.dex)
at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle$SubscriptionLambdaSubscriber.request(FlowableDoOnLifecycle.java:101)
at io.reactivex.internal.subscribers.LambdaSubscriber.request(LambdaSubscriber.java:114)
at io.reactivex.internal.operators.flowable.FlowableInternalHelper$RequestMax.accept(FlowableInternalHelper.java:220)
at io.reactivex.internal.operators.flowable.FlowableInternalHelper$RequestMax.accept(FlowableInternalHelper.java:216)
at io.reactivex.internal.subscribers.LambdaSubscriber.onSubscribe(LambdaSubscriber.java:52)
at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle$SubscriptionLambdaSubscriber.onSubscribe(FlowableDoOnLifecycle.java:73)
at io.reactivex.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.onSubscribe(FlowableObserveOn.java:294)
at io.reactivex.subscribers.SerializedSubscriber.onSubscribe(SerializedSubscriber.java:70)
at io.reactivex.internal.operators.flowable.FlowableDebounceTimed$DebounceTimedSubscriber.onSubscribe(FlowableDebounceTimed.java:78)
at io.reactivex.internal.operators.flowable.FlowableSubscribeOn.subscribeActual(FlowableSubscribeOn.java:46)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.internal.operators.flowable.FlowableDebounceTimed.subscribeActual(FlowableDebounceTimed.java:45)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.internal.operators.flowable.FlowableObserveOn.subscribeActual(FlowableObserveOn.java:56)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.internal.operators.flowable.FlowableDoOnLifecycle.subscribeActual(FlowableDoOnLifecycle.java:38)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.Flowable.subscribe(Flowable.java:14742)
at io.reactivex.Flowable.subscribe(Flowable.java:14661)
at com.yulu.ops.yuzenapp.newYuzen.ui.audit.AuditPresenter.uploadImageForAuditFailData(AuditPresenter.java:77)

Since my app targets min SDK of 21, I believe multidex is automatically enabled.
Note: I added MultiDex.install(this) in my Application class as well but the issue persists.