Dollar sign in fields after proguarding in Android

424 Views Asked by At

I have a class that gets dollar sign with random hex string after proguarding.

Before proguard:

public class MyClass<D extends Params, S extends Params, B extends Slots> extends Params<D, S> {
    private B slots;
}

After proguard:

public class MyClass<D extends g, S extends g, B extends g> extends Params<D, S> {
  private B slots$41652c7
}

How prevent such behavior?

1

There are 1 best solutions below

0
On

Add a keepclassmembers rule following this format and Proguard will not do anything with the fields in the class.

-keepclassmembers class MyClass {
    private <fields>;
}

Please note that Proguard requires the class reference to be a fully-qualified namespace.