msgpack-java icon indicating copy to clipboard operation
msgpack-java copied to clipboard

ProGuard rules for this library

Open chintan-mishra opened this issue 7 years ago • 6 comments

In an Android app, we are fetching MsgPack from our API. What are the recommended ProGuard rules to use with this library?

chintan-mishra avatar Mar 30 '18 11:03 chintan-mishra

We are not using ProGuard, so we don't have recommended rules now.

What I can say is when renaming packages, you will also need to rename package name strings here: https://github.com/msgpack/msgpack-java/blob/1447f8fb2f720697ef0dab4371c52f75a64d51cc/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L62-L64

Because msgpack-java uses reflection to load one of the MessageBuffer classes appropriate for each platform.

xerial avatar Apr 06 '18 22:04 xerial

-keepclassmembers class * {
    @org.msgpack.core.buffer.MessageBufferU <methods>;
    @org.msgpack.core.buffer.MessageBufferBE <methods>;
    @org.msgpack.core.buffer.MessageBuffer <methods>;
}

Based on my knowledge ProGuard rules mentioned above should suffice. I will test these when next release rolls out in 3 weeks.

chintan-mishra avatar Apr 07 '18 11:04 chintan-mishra

An unexpected delay will need 2 weeks or so.

chintan-mishra avatar May 03 '18 10:05 chintan-mishra

No worries. Take your time.

xerial avatar May 17 '18 01:05 xerial

-keepclassmembers class * {
    @org.msgpack.core.buffer.MessageBufferU <methods>;
    @org.msgpack.core.buffer.MessageBufferBE <methods>;
    @org.msgpack.core.buffer.MessageBuffer <methods>;
}

Based on my knowledge ProGuard rules mentioned above should suffice. I will test these when next release rolls out in 3 weeks.

sad,it does not work。 i modify like this,it works . (ubuntu14.04 mmm packages/app/settings) :

-keep class org.msgpack.core.buffer.MessageBuffer {;} -keep class org.msgpack.core.buffer.MessageBufferBE {;} -keep class org.msgpack.core.buffer.MessageBufferU {*;}

keyguansz avatar Oct 15 '18 08:10 keyguansz

@keyguansz IIRC then the new rules are leaving the packages as they were. If I get time this weekend then maybe I will try to figure out more specific rules.

chintan-mishra avatar Oct 15 '18 11:10 chintan-mishra