Android-Throwable: A WebView method was called on thread 'JavaBridge'.


错误详情:

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 + ")");
                    }
                });

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM