Skip to content
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

ProGuard rules for this library #469

Open
chintan-mishra opened this issue Mar 30, 2018 · 6 comments
Open

ProGuard rules for this library #469

chintan-mishra opened this issue Mar 30, 2018 · 6 comments
Labels

Comments

@chintan-mishra
Copy link

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

@xerial
Copy link
Member

xerial commented Apr 6, 2018

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:

private static final String UNIVERSAL_MESSAGE_BUFFER = "org.msgpack.core.buffer.MessageBufferU";
private static final String BIGENDIAN_MESSAGE_BUFFER = "org.msgpack.core.buffer.MessageBufferBE";
private static final String DEFAULT_MESSAGE_BUFFER = "org.msgpack.core.buffer.MessageBuffer";

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

@xerial xerial added the question label Apr 6, 2018
@chintan-mishra
Copy link
Author

-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
Copy link
Author

An unexpected delay will need 2 weeks or so.

@xerial
Copy link
Member

xerial commented May 17, 2018

No worries. Take your time.

@keyguansz
Copy link

-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 {*;}

@chintan-mishra
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants