What is the correct proguard?
See original GitHub issueHi, team, when my project is using StateSaver in Activity/Fragment, it’s fine, because default proguard will keep the name for system views. but when I use for custom file, it can not find injector because of obfuscate.
I check the README, it shows This library comes with a ProGuard config. No further steps are required, but all necessary rules can be found here.
I checked the sample, it’s
-dontwarn com.evernote.android.state.**
-keep class com.evernote.android.state.** { *; }
-keep class **$$StateSaver { *; }
-keepclassmembers class * {
@com.evernote.android.state.StateReflection <fields>;
}
it will keep the generate class, but it won’t keep the class with @State annotation, I don’t know what is StateReflection.
then I change it to
-dontwarn com.evernote.android.state.**
-keep class com.evernote.android.state.** { *; }
-keep class **$$StateSaver { *; }
-keepclasseswithmembernames class * {
@com.evernote.android.state.* <fields>;
}
-keepnames class * { @com.evernote.android.state.State *;}
it works.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Configuring ProGuard | CodePath Android Cliffnotes
ProGuard is a tool to help minify, obfuscate, and optimize your code. It is not only especially useful for reducing the overall size...
Read more >Java Obfuscator and Android App Optimizer | ProGuard
ProGuard is a command-line tool that reduces app size by shrinking bytecode and obfuscates the names of classes, fields and methods. It's an...
Read more >Android Proguard, obfuscation, reduce app size - Medium
What is Proguard? ProGuard is a free Java tool in Android that performs three major roles: 1. Shrink/minify the code (remove unused code...
Read more >ProGuard in Android - GeeksforGeeks
Proguard is a great tool for creating a production-ready application in Android. It assists us in reducing code and making apps faster. Proguard ......
Read more >What is the correct ProGuard definition for latest mp4parser ...
Tested with mp4parser version 1.1.7: -keep class * implements com.coremedia.iso.boxes.Box { *; } -dontwarn com.coremedia.iso.boxes.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, the rule
-keepnames class * { @com.evernote.android.state.State *;}
seems to be necessary. Good catch!The downside is that this rule also preserves the variable names, although they could be obfuscated. But I didn’t find a proguard rule that only keeps the class name and not variable names although they’re matching.
Released: https://github.com/evernote/android-state/releases/tag/v1.1.1