0

If I have a proguard rule as follows...

-keep class com.mycompany.myapp.** { *; }

... Then are the following two rules obsolete and unnecessary...

-keep public class com.mycompany.myapp.** { *; }
-keep class com.mycompany.myapp.SomeClass$* { *; }

?

i.e. does the former rule supersede and include the latter two?

Adil Hussain
  • 30,049
  • 21
  • 112
  • 147

1 Answers1

1

You are correct in that

-keep class com.mycompany.myapp.** { *; }

Overrides the other two rules. Here's an example:

Before Proguard:

package com.mycompany.myapp;
public class Main {
    public static void main(String[] args) { new Main().init(); }
    private void init(){
        PackageInnerClass pic1 = new Main.PackageInnerClass();
        PublicInnerClass pic2 = new Main.PublicInnerClass();
        PrivateInnerClass pic3 = new Main.PrivateInnerClass();
    }
    class PackageInnerClass { void method1() { System.out.println("Method 1"); } }
    public class PublicInnerClass { void method2() { System.out.println("Method 2"); } }
    private class PrivateInnerClass { void method3() { System.out.println("Method 3"); } }
}

After Proguard (with your rule): enter image description here

The only difference is that the classes are moved to their own .class files. But functionally they're the same.

Display Name
  • 942
  • 1
  • 10
  • 20