錯誤詳情:
01-30 03:36:52.441 12000-12048/cn.h5 D/@@@: e.ttt:java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'JavaBridge'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {18b9c7c8} called on Looper (JavaBridge, tid 481) {789820c}, FYI main Looper is Looper (main, tid 1) {18b9c7c8})
當出現以上錯誤后,處於阻塞狀態,無任何效果,出現此錯誤的原因是:
webView.loadUrl("javascript:show(" + json + ")");
解決方法:
runOnUiThread(new Runnable() { @Override public void run() { webView.loadUrl("javascript:show(" + json + ")"); } });