0

innerclass obfuscation code in android studio 4.0(macOs)

B is the internal interface of A.

proguard-rules.pro:

...
-keep class A$B
-keepclassmembers class A {
public static <methods>;
}
-keepclassmembers class A$B {
<methods>;
}
...

mapping.txt:

...
A$B -> A$B:
    ...
...

the name of 'B' becomes 'A$B' after confusion, B becomes the external interface A$B。

Why?

Now, it sdk packaging into aar,other devploer can only use A$B to call B,but i think use A.B to call B。how to do? 3q。

麦均贤
  • 1
  • 1

1 Answers1

0

Try this.

-keepattributes Exceptions,InnerClasses,...
-keep class [packagename].A{
    *;
}
-keep class [packagename].A$* {
    *;
}

Reference: Android proguard, keep inner class

simon5678
  • 249
  • 1
  • 5