【发布时间】:2019-05-29 14:44:31
【问题描述】:
我尝试在下面使用 android WebView 显示此 url,但在 WebViewClient 回调 onReceivedError 中未收到任何错误。但是看起来js文件有问题,写了下面的日志。如何解决此问题或在应用程序中显示此网址?
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'theme' of null",来源:https://tronscan.org/static/js/vendors.9044c224.js (1)
<WebView android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
@BindView(R.id.webview) WebView eWebview;
eWebview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
if(progress == 100 && !isLoaded) {
Log.i(TAG, "Progress:"+progress);
isLoaded = true;
}
}
});
eWebview.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show();
}
});
WebSettings webSettings = eWebview.getSettings();
webSettings.setJavaScriptEnabled(true);
eWebview.loadUrl("https://tronscan.org/#/transaction/e760f270b2f44658019f4a24ebc1b797f3adb1e6f6725a80475d5c96f0d6bc83");
【问题讨论】: