RxJava icon indicating copy to clipboard operation
RxJava copied to clipboard

Add visibility of proguard rules to README or wiki please

Open isuPatches opened this issue 11 years ago • 28 comments

Are there examples of proguard rules that will work with minifyEnabled set to true? I'm currently getting:

 java.lang.NoSuchMethodError: No virtual method doOnSubscribe(Lrx/functions/Action0;)Lrx/Observable

isuPatches avatar Jul 21 '15 21:07 isuPatches

With those rules there's no point in using ProGuard. You're keeping the entire library and preventing ProGuard from actually doing anything.

On Sun, Jun 12, 2016, 5:04 AM Artem Zinnatullin [email protected] wrote:

See #3459 https://github.com/ReactiveX/RxJava/issues/3459

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ReactiveX/RxJava/issues/3097#issuecomment-225418218, or mute the thread https://github.com/notifications/unsubscribe/AAEEEQwhWw6x7B83eDHcB4WB14Y4J4oTks5qK8uUgaJpZM4FdG5S .

JakeWharton avatar Jun 12 '16 15:06 JakeWharton

Just to clear this up, again, please see @desseim's post here: https://github.com/ReactiveX/RxJava/issues/3097#issuecomment-158485012.

jaredsburrows avatar Jun 12 '16 15:06 jaredsburrows

Probably they want to shrink all other libraries and keep RxJava to avoid crash on Samsung ¯(ツ)/¯

On Sun, 12 Jun 2016, 18:05 Jake Wharton, [email protected] wrote:

With those rules there's no point in using ProGuard. You're keeping the entire library and preventing ProGuard from actually doing anything.

On Sun, Jun 12, 2016, 5:04 AM Artem Zinnatullin [email protected] wrote:

See #3459 https://github.com/ReactiveX/RxJava/issues/3459

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/ReactiveX/RxJava/issues/3097#issuecomment-225418218 , or mute the thread < https://github.com/notifications/unsubscribe/AAEEEQwhWw6x7B83eDHcB4WB14Y4J4oTks5qK8uUgaJpZM4FdG5S

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ReactiveX/RxJava/issues/3097#issuecomment-225440700, or mute the thread https://github.com/notifications/unsubscribe/AA7B3MhxRgW-Cru7yayoFi2xaLfvwgrvks5qLCBGgaJpZM4FdG5S .

artem-zinnatullin avatar Jun 12 '16 15:06 artem-zinnatullin

Well yes, this ProGuard config doesn't do a thing with RxJava, we mostly use to to shrink down other stuff. This might not be the most optimal thing to do, but the point here is that we're keeping everything from Rx and the issue still happens.

I might miss something, but the way I see it, the links you provided discuss how ProGuard might screw things up with a config that enables it to shrink RxJava.

My hunch is still that this is due to some funky Samsung-specific thing on their Android versions I mentioned. As a short-term workaround, I'll use the 'rx.unsafe-disable' to disable Unsafe.

rzsombor avatar Jun 13 '16 08:06 rzsombor

You can disable Unsafe only on Samsung devices btw.

On Mon, 13 Jun 2016, 11:00 Zsombor Erdődy-Nagy, [email protected] wrote:

Well yes, this ProGuard config doesn't do a thing with RxJava, we mostly use to to shrink down other stuff. This might not be the most optimal thing to do, but the point here is that we're keeping everything from Rx and the issue still happens.

I might miss something, but the way I see it, the links you provided discuss how ProGuard might screw things up with a config that enables it to shrink RxJava. As a short-term workaround, I'll use the 'rx.unsafe-disable' to disable Unsafe.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ReactiveX/RxJava/issues/3097#issuecomment-225512794, or mute the thread https://github.com/notifications/unsubscribe/AA7B3Ai3ZgaMc1zjg9vFSavLX_1hVh6Lks5qLQ42gaJpZM4FdG5S .

artem-zinnatullin avatar Jun 13 '16 08:06 artem-zinnatullin

@rzsombor, we encountered a very similar issue with a different library (greenDAO), maybe it could shed some light on the issue you encountered here.

We get: System.err: Caused by: java.lang.NoSuchFieldException: TABLENAME System.err: at java.lang.Class.getField(Class.java:1104) System.err: at de.greenrobot.dao.internal.DaoConfig.(SourceFile:56)

Only happens on Samsung 5.0/5.0.1/5.0.2 devices in the wild, we can't reproduce this issue in-house.

We have the recommended greenDAO proguard configuration.

Decompiling our APK shows that the "problematic" class does indeed have a public TABLENAME field: .field public static final TABLENAME:Ljava/lang/String; = "GLIDE_USER"

So we can only join your conclusion that it's a weird Samsung bug. Unfortunately, we don't even have a work-around... Kinda hoping the guys in this project can come up with something...

Btw, other people encountered the same issue with greenDAO (note that the suggested solutions such as adding proguard rules or upgrading to the latest version do not solve the issue): http://stackoverflow.com/questions/34216163/daoconfig-init-failure-with-greendao-on-samsung-devices-with-android-5-0 https://github.com/greenrobot/greenDAO/issues/188

eranpolo avatar Jun 13 '16 08:06 eranpolo

@artem-zinnatullin Oh yes, forgot to add that - only switching Unsafe off on these problematic device - OS combinations.

@eranpolo Thanks the extra info. I'm still trying to get my hands on an affected device to get to the bottom of this.

Edit: for reference, our current naive workaround for the Samsung-issue:

if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP && "samsung".equalsIgnoreCase(Build.MANUFACTURER)) {
    System.setProperty("rx.unsafe-disable", "True");
}

rzsombor avatar Jun 13 '16 09:06 rzsombor

@rzsombor a list of devices that it happened to here are:

  • SM-N915v
  • SM-S978L
  • SM-N900T
  • SM-G900V
  • SMG900P
  • SAMSUNG-SM-G870A
  • SM-T530NU
  • SM-T350
  • SM-P550
  • GT-I9515

all of those devices had this crash after adding the proguard rules from https://github.com/greenrobot/greenDAO/issues/188

yishai-glide avatar Jun 15 '16 06:06 yishai-glide