How to stop ProGuard from stripping the Serializable interface from a class

前端 未结 2 1965
遇见更好的自我
遇见更好的自我 2021-02-19 07:31

Is there an explicit way to stop ProGuard from changing a class from implementing an interface?

I have a class that implements java.io.Serializable, let\'s

2条回答
  •  无人共我
    2021-02-19 08:05

    I had the same issue fixed using below config.

    -keepnames class * implements java.io.Serializable
    -keepclassmembers class * implements java.io.Serializable {
        static final long serialVersionUID;
        private static final java.io.ObjectStreamField[] serialPersistentFields;
        !static !transient ;
        private void writeObject(java.io.ObjectOutputStream);
        private void readObject(java.io.ObjectInputStream);
        java.lang.Object writeReplace();
        java.lang.Object readResolve();
    }
    

    Official Documentation http://proguard.sourceforge.net/manual/examples.html#serializable

提交回复
热议问题