Closed keegan-z closed 4 years ago
看源码 好像是 gson解析的类被混淆了
/**
@param message Message */ public void dispatchMessage(Object message) {
String messageJson = new Gson().toJson(message); //escape special characters for json string 为json字符串转义特殊字符 messageJson = messageJson.replaceAll("(\\\\)([^utrn])", "\\\\\\\\$1$2"); messageJson = messageJson.replaceAll("(?<=[^\\\\])(\")", "\\\\\""); messageJson = messageJson.replaceAll("(?<=[^\\\\])(\')", "\\\\\'"); messageJson = messageJson.replaceAll("%7B", URLEncoder.encode("%7B")); messageJson = messageJson.replaceAll("%7D", URLEncoder.encode("%7D")); messageJson = messageJson.replaceAll("%22", URLEncoder.encode("%22")); String javascriptCommand = String.format(BridgeUtil.JS_HANDLE_MESSAGE_FROM_JAVA, messageJson); BridgeLog.d(TAG,"javascriptCommand->"+javascriptCommand); // 必须要找主线程才会将数据传递出去 --- 划重点 if (Thread.currentThread() == Looper.getMainLooper().getThread()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT&&javascriptCommand.length()>=BridgeUtil.URL_MAX_CHARACTER_NUM) { mWebView.evaluateJavascript(javascriptCommand,null); }else { mWebView.loadUrl(javascriptCommand); } }
}
已解决 加上-keep class com.smallbuer.jsbridge.core.* { ; }就好了
谢谢!
看源码 好像是 gson解析的类被混淆了
/**
@param message Message */ public void dispatchMessage(Object message) {
}