我有带有 XWalkView 的 Android 原生应用程序。一切正常,直到进入 html5 视频全屏模式(youtube 或简单的 html 视频标签)。
在 logcat 和应用程序崩溃中出现错误:
03-01 23:23:27.759 7879-7879/? E/chromium:[ERROR:xwalk_autofill_client.cc(116)] 未在虚拟 void xwalk::XWalkAutofillClient::OnFirstUserGestureObserved() 中实现
03-01 23:23:27.909 7879-7879/? A /铬:[致命:jni_android.cc(249)]检查失败:假。请在崩溃报告中包含 Java 异常堆栈
03-01 23:23:27.909 7879-7879/? A/libc: 致命信号 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 7879 (eu.my.app.MyApp)
应用程序代码只是来自人行横道网站的示例:
public class MyActivity extends XWalkActivity {
XWalkView mXwalkView;
class MyResourceClient extends XWalkResourceClient {
MyResourceClient(XWalkView view) {
super(view);
}
@Override
public WebResourceResponse shouldInterceptLoadRequest(XWalkView view, String url) {
return super.shouldInterceptLoadRequest(view, url);
}
}
class MyUIClient extends XWalkUIClient {
MyUIClient(XWalkView view) {
super(view);
}
@Override
public void onFullscreenToggled(XWalkView view, boolean enterFullscreen) {
super.onFullscreenToggled(view, enterFullscreen);
}
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
super.addContentView(view, params);
}
@Override
protected void onXWalkReady() {
mXwalkView = new XWalkView(this, this);
setContentView(R.layout.main);
((FrameLayout) findViewById(R.id.myContainer)).addView(mXwalkView);
mXwalkView.setResourceClient(new MyResourceClient(mXwalkView));
mXwalkView.setUIClient(new MyUIClient(mXwalkView));
mXwalkView.load("http://www.youtube.com/", null);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public Window getWindow() {
return super.getWindow();
}
@Override
protected void onPause() {
super.onPause();
if (mXwalkView != null) {
mXwalkView.pauseTimers();
mXwalkView.onHide();
}
}
@Override
protected void onResume() {
super.onResume();
if (mXwalkView != null) {
mXwalkView.resumeTimers();
mXwalkView.onShow();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mXwalkView != null) {
mXwalkView.onDestroy();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mXwalkView != null) {
mXwalkView.onActivityResult(requestCode, resultCode, data);
}
}
@Override
protected void onNewIntent(Intent intent) {
if (mXwalkView != null) {
mXwalkView.onNewIntent(intent);
}
}
}