更新时间:2023-12-04 08:45:52
您需要指定要使用正确的符号,以保持内部类。
在ProGuard的说法,这意味着 -keep类my.outer.Class $ MyInnerClass
。这里的关键是使用美元符号( $
)的内部和外部类之间的分隔符。
You need to specify that you want to keep the inner class using the proper notation.
In the proguard parlance, that means -keep class my.outer.Class$MyInnerClass
. The key here is using the dollar-sign ($
) as the separator between inner and outer class.
要做到这一点,你还必须指定 -keepattributes InnerClasses
,以便名称 MyInnerClass
不得到模糊处理。这两个设置在一起应该让你的内部类可保持不变。
To do this, you also have to specify -keepattributes InnerClasses
, so that the name MyInnerClass
doesn't get obfuscated. These two settings together should allow your inner classes to be kept intact.