Open alissongodoi opened 6 years ago
I have noticed that the issue goes away when minify is disabled. I have no idea why minify is causing this issue in the release build.
It looks like it solves the issue by forcing minify to not remove the druk classes
-dontwarn com.github.druk. -keep class com.github.druk. { *; }
@alissongodoi Proguard make obfuscation of all you classes. It's rename all of them to a.b.c.d.etc. You are not first person who face this problem #19.
Maybe I should ship AAR with proguard rules inside. I'm going to investigate if it's possible
@andriydruk: Should be possible with consumerProguardFiles. Otherwise I would recommend maybe put the rules in the readme (like in retrofit).
As mentioned by @G00fY2, you should be able to just add a file called consumer-proguard-rules.pro
in the same directory as your build.gradle
. Then, add this line in build.gradle
in defaultConfig
:
consumerProguardFiles 'consumer-proguard-rules.pro'
I can open a PR if you'd like.
The above proguard rules work, but they are overly broad. For my app, I noticed the following method counts on com.github.druk
when using proguard to minify:
Without rules: 106 With rules: 394
I tried adding individual rules for each JNI reference, but I gave up. I would suggest moving all the JNI stuff into its own package so you can take care of it with a single proguard rule like -keep com.github.druk.dnssd.jni.** { *; }
without needlessly keeping all the rest of the code.
i believe you need to keep rx.* as well:
-keep class com.github.druk.** { *; }
-keep class rx.** { *; }
I can open a PR if you'd like.
Please do this.
-keep class com.github.druk.dnssd.* { ; }
work well!
After compiling the app and installing it on the Android Emulator 6.0 it crashes with the following error on startup:
This is the implementation settings at gradle:
In proguard rules I had the following which I removed:
I guess it is falling into this piece of code being null?
Observe that this just happens when I compile for Release. It is working ok for other releases. These are my proguard rules: