Cause by:All WebView methods mus
2019-08-07 本文已影响0人
Dirtykk
项目中使用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操作放在主线程中即可。