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 }
You can obfuscate Android code to provide security against reverse engineering. You can use the Android ProGuard tool to obfuscate, shrink, and optimize your code. Obfuscated code can be more difficult for other people to reverse engineer.
R8 is another tool that will convert your java byte code into an optimized format of dex code. It will check the whole application and will remove the unused classes and methods. It helps us to reduce the size of our APK and to make our app more secure. R8 uses similar proguard rules to modify its default behavior.
-keep disables all of ProGuard's goodness. No shrinking, no obfuscation; not for classes, not for members. In real use cases, you can let ProGuard do at least some of it's work.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With