ProGuard: keep private Inner Class

安稳与你 提交于 2019-12-07 05:59:28

问题


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

回答1:


This should work:

-keep public class com.xxx.droid.activity.LoginActivity$* {
        *;
 }



回答2:


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


来源:https://stackoverflow.com/questions/16919058/proguard-keep-private-inner-class

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!