Toolvito

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

Write keep rules for the classes that code finds by name: reflection, JSON, native code, classes named in XML.

Your values

Such as org.example.optional.**. A line with only ** would hide every warning.

Rules

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.

Which classes your rules keep (matched on the server)

Which classes each rule keeps

Uses the rules above (or a .pro file you add here). Choose JAR or AAR files of your app or its libraries, or the mapping.txt of a release build, up to 20 files. You get rules.csv (classes matched by each rule, rules that match nothing, kept classes that were renamed), matches.csv and the problems of the rules.

Or drop files here. JAR, AAR, ZIP, TXT, MAP, MAPPING, PRO, CFG or CONF, up to 20 files, 500 MB each at most.

    The rules are made and checked in your browser. When you use the box below, the JAR, AAR and mapping files you choose there and the rules shown above are sent to the Toolvito server; the class files are read, never run. Download the result within one hour after the job finishes. Choose Delete files now to request earlier removal. The hourly cleanup normally removes files within one to two hours after completion.

    How to make keep rules

    1. In each row choose the kind of rule, type the class name or a pattern, and choose the members to keep.
    2. 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.
    3. Tick May be removed, May be optimized or May be renamed to soften a rule (the modifiers allowshrinking, allowoptimization and allowobfuscation).
    4. 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 ** { *; }), -dontwarn without 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.

    Related tools