florent37 / Wear-Emmet

Emmet is an protocol based data-transfer for Android Wear
http://florent37.github.io/Emmet
Apache License 2.0
41 stars 11 forks source link

Emmet and ProGuard #11

Closed andkulikov closed 9 years ago

andkulikov commented 9 years ago

Hello! I just noticed one thing, when you use proguard for release build all interfaces which will be used with emmet.createSender(...) should be marked as "-keep class ..." in proguard rules. without it nothing works.

andkulikov commented 9 years ago

i am figure out the real problem! its Gson!

i fix my release build with adding this lines in proguard configs:

# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

-keep public class * {
    public protected *;
}

##---------------Begin: proguard configuration for Gson  ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

##---------------End: proguard configuration for Gson  ----------
florent37 commented 9 years ago

great :)

Man I gave you the write access on the repo, you can modify the current Readme & code. I'll send it to jcenter next ;)

andkulikov commented 9 years ago

ok, I know about write access. I just want to discuss the problem) I will commit some another changes soon.

florent37 commented 9 years ago

I never used Proguard :/ so I trust you in this point bro' :)

2015-06-05 10:39 GMT+02:00 Andrey Kulikov notifications@github.com:

ok, I know about write access. I just want to discuss the problem) I will commit some another changes soon.

— Reply to this email directly or view it on GitHub https://github.com/florent37/Wear-Emmet/issues/11#issuecomment-109204124 .