Calculates on this device. File exports run online.
ProGuard Rule Generator
Fill in a row for each class that code finds by name (reflection, JSON, native code, classes named in XML) and press Make the rules. You get a proguard-rules.pro file and each rule in plain words. You can also check a rules file you already have.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to make keep rules
- In each row choose the kind of rule, type the class name or a pattern, and choose the members to keep.
- Add extends or implements and a parent class to keep every class below it, or an annotation to keep only the classes that carry it.
- Tick May be removed, May be optimized or May be renamed to soften a rule (the modifiers allowshrinking, allowoptimization and allowobfuscation).
- Press Make the rules, then copy or download proguard-rules.pro.
Class names and patterns
?is one character of a name,*is any part of a name without dots,**is any part with dots:com.example.model.**is every class in that package and its sub-packages.- On its own,
*means any class in any package, as in-keep class * extends com.example.Plugin. - Several names may be joined with commas, and
!before a name leaves it out:!com.example.internal.**,com.example.**. The first name that matches decides. - class also matches interfaces; interface, enum and annotation match only those kinds. extends and implements mean the same and match classes below the parent at any depth, not the parent itself.
What the check finds
- Options that ProGuard does not have, and modifiers that keep options do not have.
- Class specifications without class, interface or enum, or without a class name; braces that do not match; members without a closing semicolon.
- Rules that keep every class and member (
-keep class ** { *; }),-dontwarnwithout a filter (it hides every warning),-ignorewarnings, and options that turn off renaming, shrinking or optimization. - Rules that appear twice.
Limits you should know
- The options are those of the ProGuard manual. Android R8 reads the same rule files but does not support every ProGuard option; such options are not marked here.
- Members are checked for their form, not against your code. The box below shows which classes each rule matches in your JAR or AAR files, and which kept classes were still renamed in a build’s mapping file.
- The page does not know which libraries your app uses. Many libraries bring their own rules; read their documentation before you add rules for them.