Prevent Proguard from removing empty constructor of fragment
android, constructor, fragment, proguard
Solution
This should work :
-keepclassmembers public class * extends android.support.v4.app.Fragment {
public <init>(...);
I believe even this should be enough :
-keep public class * extends android.support.v4.app.Fragment
as keeping the class will oblige proguard to keep the default constructor.
Problem
You know, all subclasses of Fragment must include a public empty constructor but when using proguard these constructors will be removed. I have specified below commands but empty constructor still be removed. Can anyone help me to keep empty constructor of Fragment? Thanks you. ``` -keepclassmembers public class * extends android.support.v4.app.Fragment { public <init>(***); #public <init>(); //already tried this } -keepclassmembers public class * extends com.xxx.MyFragment { public <init>(***); #public <init>(); //already tried this } ```