一个极其简单的应用程序,API级别24(Android 7.0),尝试在实际物理设备上的唯一活动中加载WebView,并在日志中提供以下内容并停止该应用程序:
df1.merge(df2, left_on ='A', right_on='Red', how='outer').bfill(axis=1)\
.drop(['A','Red'], axis=1).rename(columns={'B':'Red'})
Red Blue Green Yellow
0 1 10 car four
1 1 11 Bus six
2 2 10 car four
3 2 11 Bus six
4 3 10 car four
5 3 11 Bus six
6 y 12 bike two
7 z 13 cycle two
和
I/cr_DRP: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
和
W/System.err: java.lang.SecurityException: BIND_EXTERNAL_SERVICE failed, ComponentInfo{com.android.webview/org.chromium.content.app.SandboxedProcessService0} is not an externalService
这是怎么回事?某种版本/依赖性问题?如何纠正?
用于WebView的XML:
A/chromium: [FATAL:jni_android.cc(233)] Check failed: false. Please include Java exception stack in crash report
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 6989 (Chrome_ProcessL)
WebView代码:
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
答案 0 :(得分:0)
我也遇到java.lang.SecurityException: BIND_EXTERNAL_SERVICE
的类似问题,因为我的情况是manifest.xml中缺少互联网许可。
uses-permission android:name="android.permission.INTERNET"
答案 1 :(得分:0)
尚未启用JavaScript似乎是一个可能的原因(默认情况下已禁用):
mWebView = findViewById(R.id.webview);
myWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("https://google.com");
答案 2 :(得分:0)
首先检查清单中是否正确提供了权限。
uses-permission android:name="android.permission.INTERNET"
如果默认情况下在加载网址时包含了此内容,则它会尝试重定向到chrome浏览器。我认为这是导致崩溃的原因。反正不确定。添加以下代码将其停止。
mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
return false; // then it is not handled by default action
}
});
答案 3 :(得分:0)
Webview对象将是wv
wv.setWebChromeClient(
new WebChromeClient() {
long mStartRX = TrafficStats.getTotalRxBytes();
long mStartTX = TrafficStats.getTotalTxBytes();
@Override
public void onConsoleMessage(String message, int lineNumber, String sourceID) {
Log.d("MyApplication", message + " -- From line "
+ lineNumber + " of "
+ sourceID);
}
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
long rxBytes = TrafficStats.getTotalRxBytes() - mStartRX;
long txBytes = TrafficStats.getTotalTxBytes() - mStartTX;
Log.d("TRAFFIC", "Current Bytes Rx ==> " + rxBytes
+ " Bytes Tx ==> " + txBytes
+ " New progress ==> " + newProgress);
}
});
wv.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
pb.setVisibility(View.VISIBLE);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
wv.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
}
});