ProGuard obfuscating classes even after `keep class` flag. Affecting Android WebView behavior

时光毁灭记忆、已成空白 提交于 2019-12-01 02:15:12

You can instruct ProGuard to keep all annotated methods:

-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

This should probably be part of the default configuration in the Android SDK.

Not sure if it is just a typo in your post or not, but the ProGuard configuration file refers to

com.myapp.android.JavaScriptInterface

whereas your Java class indicates a different package

package com.myclass.android; // myapp != myclass

and, of course, they must be the same.

EDIT: in addition to your existing configuration, try adding the following option:

-keepclassmembers class com.myclass.android.JavaScriptInterface { 
    public <methods>;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!