New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RX Android & Proguard #350
Comments
@supercairos Are you sure this is proguard related? Does the first example work without proguard? |
I don't see any correlation between this issue and ProGuard rules, maybe you store resulting subscription and unsubscribe it somewhere and it creates "race" condition so you unsubscribe from the chain before it completes? |
Race condition was a good idea, but i disabled the code that manage subscription and I still have the issue :( Yes, try to run this sample : Observable.range(10, 20)
.flatMap(integer -> Observable.zip(
Observable.just(integer),
Observable.just(30),
(integer1, integer2) -> integer1
))
.doOnNext(integer -> Log.v("RxJava", "1) >> " + integer))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(integer -> Log.v("RxJava", "2) >> " + integer), throwable -> {
})) Without proguard : With proguard : Using my work around (with Observable.range(10, 20)
.flatMap(integer -> Observable.zip(
Observable.just(integer),
Observable.just(30),
(integer1, integer2) -> integer1
))
.doOnNext(integer -> Log.v("RxJava", "1) >> " + integer))
.subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
.subscribe(integer -> runOnUiThread(() -> Log.v("RxJava", "2) >> " + integer)), throwable -> {
})) |
These are my dependencies : ext {
support = '25.0.0'
play_services = '9.8.0'
// HTTP
okhttp = '3.4.1'
retrofit = '2.1.0'
glide = '3.7.0'
// DEPS INJECTION
dagger = '2.6'
// VIEW INJECTION
butterknife = '8.4.0'
// DEBUG
stetho = '1.4.1'
}
dependencies {
compile "com.android.support:support-annotations:${support}"
compile "com.android.support:support-v4:${support}"
compile "com.android.support:design:${support}"
compile "com.android.support:appcompat-v7:${support}"
compile "com.android.support:cardview-v7:${support}"
compile "com.android.support:recyclerview-v7:${support}"
compile "com.android.support:palette-v7:${support}"
// Firebase
releaseCompile "com.google.firebase:firebase-crash:${play_services}"
// GSON
compile 'com.google.code.gson:gson:2.7'
// RxJava
compile 'io.reactivex:rxandroid:1.2.1'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
compile 'io.reactivex:rxjava:1.1.6'
// OkHttp
compile "com.squareup.okhttp3:okhttp:${okhttp}"
compile "com.squareup.okhttp3:logging-interceptor:${okhttp}"
compile "com.squareup.retrofit2:retrofit:${retrofit}"
compile "com.squareup.retrofit2:converter-gson:${retrofit}"
compile "com.squareup.retrofit2:adapter-rxjava:${retrofit}"
// Glide
compile "com.github.bumptech.glide:glide:${glide}"
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@jar'
// Dagger
compile "com.google.dagger:dagger:${dagger}"
annotationProcessor "com.google.dagger:dagger-compiler:${dagger}"
// Butterknife
compile "com.jakewharton:butterknife:${butterknife}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterknife}"
// ###################### DEBUG
// Setho
debugCompile "com.facebook.stetho:stetho:${stetho}"
debugCompile "com.facebook.stetho:stetho-okhttp3:${stetho}"
// ###################### CUSTOM
// Setho
customCompile "com.facebook.stetho:stetho:${stetho}"
customCompile "com.facebook.stetho:stetho-okhttp3:${stetho}"
} |
Please provide a full sample that demonstrates the problem with as minimal On Mon, Nov 14, 2016 at 5:41 AM Romain Caire notifications@github.com
|
Try this project : https://github.com/supercairos/rxjava_proguard_error It's a fairly barebone project. It's the default project created by Android Studio 2.3 C + the added code provided above and Jack enabled. I've included a keystore and registered it in the gradle so you don't have to create one. Note : I had to add some lines to the proguard.pro files as Jack doesn't seams to read it directly from the AAR? |
is this question (my question) related? http://stackoverflow.com/questions/41581958/rxjava-android-not-working-in-release-mode-signed-apk when in debug mode, my app working fine, but after generate apk release, not working :( |
i have the same issue , client is asking for release apk and now every functionality that relates to rxjava is not working , in debug mode it works as expected. build.gradle(project)
build.gradle(module)
progaurd:
|
what more info is needed ? @JakeWharton |
It seems this will affect a lot from this great library.....anyway thanks for bringing the great lib @JakeWharton and all the work your team and you have provided to us completely free. Are there any news about this bug did anyone manage to fix it i am experiencing the same issue right now and nothing works... For me everything is working fine until the release and after that i think the problem is inside the AndroidScheduler.mainThread() seems like the problem is in the Scheduler.... |
I can confirm that debug is working but release is stopping between 15-25 emissions. I did some digging. The issue is not proguard but Jack. Here's what I did to the above sample:
I add Next I turn Jack back on but this time with the above line in the proguard rules. The output is still incorrect. Another data point: Jack without proguard works fine Not sure if this helps. |
I don't have jack enabled and i am not using any java 1.8 at all and it still doesn't work in release. |
I had the same error, I check the dependencies and its turn out the problem was mixing Rxjava with RxJava2. |
Yep please look into your RxJava and RxAndroid versions look's like the old latest version have some problems but if you use the new version of Rx2 and i suggest you do you will not have any problems with that there are new configurations. And the library just rocks this time! Seems really great so far! Thanks guys |
What is jack |
I'm facing the same issue where the debug build is running perfect and release without minify (proguard) is working perfect but the same release build with minify is failing on the Rx side. |
@AkshayChordiya try RxJava2 |
@hahn I'm already using RxJava2 |
@546201056 Jill's friend |
This can also be closed then since only RxJava 1.x requires Proguard rules which is EOL. |
ProGuard rules. Nothing requires ProGuard. |
Yeah corrected it. |
Hi,
I ran into a small issue when releasing into pro-guard.The method
AndroidSchedulers.mainThread()
makes the subscription to never be called:This will not work (Hello will never show):
This works as expected :
I'm using Jack and the latest AndroidStudio Gradle plugin (2.2.2)
I've attached my proguard file in case you want to have a look:
proguard-rules.txt
The text was updated successfully, but these errors were encountered: