项目中使用webview与js进行交互的过程中,重新调用loadurl出现了运行时错误,Cause by:All WebView methods must be called on the same thread ,在js调用后的Java回调线程并不是主线程。导致了程序出现崩溃或提示”程序无法运行“,解决此类异常,将webview操作放在主线程中即可。
![](https://img.haomeiwen.com/i16483549/3c0b52f6ecb70098.png)
项目中使用webview与js进行交互的过程中,重新调用loadurl出现了运行时错误,Cause by:All WebView methods must be called on the same thread ,在js调用后的Java回调线程并不是主线程。导致了程序出现崩溃或提示”程序无法运行“,解决此类异常,将webview操作放在主线程中即可。
本文标题:Cause by:All WebView methods mus
本文链接:https://www.haomeiwen.com/subject/eozndctx.html
网友评论