ProGuard: keep private Inner Class

2019-04-29 15:26发布

How to keep private Inner Class in ProGuard. I am already using($ for inner class) below code in my proguard.cfg but its not working.

-keep public class com.xxx.droid.activity.LoginActivity$JsInterface

2条回答
我只想做你的唯一
2楼-- · 2019-04-29 16:17

If the inner class is private, you shouldn't use the public keyword in the template, because it won't match. The compiler will actually compile the class as a package visible class (private classes don't exist at a bytecode level). Therefore:

-keep class com.xxx.droid.activity.LoginActivity$JsInterface
查看更多
不美不萌又怎样
3楼-- · 2019-04-29 16:26

This should work:

-keep public class com.xxx.droid.activity.LoginActivity$* {
        *;
 }
查看更多
登录 后发表回答