«

android javascript 混淆配置。

时间:2024-3-2 17:24     作者:韩俊     分类: Android


1,定义javascrip接口对象。

private class JsApi {

    @JavascriptInterface<br />
    public void onLoginCallback(String account, String token) {<br />



GLogger.e("lich", "from jsp:" + account + "," + token);

// send broadcast to ui process.

Intent it = new Intent(LoginCallbackReceiver.ACTION_LOGIN_CALLBACK);

it.putExtra(LoginCallbackReceiver.EXTRA_ACCOUNT, account);

it.putExtra(LoginCallbackReceiver.EXTRA_TOKEN, token);

getApplicationContext().sendBroadcast(it);

//

finish();



}



@JavascriptInterface

public String getAppSign() {



return AppManager.getAppSignEncodedByMd5(getApplicationContext());

}


}

2,在混淆文件proguard中配置:

-keepclassmembers class com.speektool.ui.activities.WebviewActivity$JsApi {
public *;
}
-keepattributes *JavascriptInterface*

-keepattributes *Annotation*






标签: android

热门推荐