因为我想通过我的Android应用程序上的iframe连接到Facebook。当我尝试输入用户名和密码时发生崩溃。特别是当我第一次输入用户名或密码时,我可以输入数据,但是当我从用户名字段切换到密码字段时,反之亦然,我遇到了崩溃。
此崩溃仅针对android lolipop
崩溃日志只说这个:
12-17 14:52:04.242 A/chromium﹕ [FATAL:jni_android.cc(271)] Check failed: false.
12-17 14:52:04.243 A/libc﹕ Fatal signal 6 (SIGABRT),code -6 in tid 28156
为facebook / gmail连接设置android webview iframe的代码是:
public static void show(Activity mainActivity, Context mainContext, WebViewClient client, IframeAgentInterface javascriptInterface, String javascriptInterfacename,String url,int width, int height)
{
boolean isLocalFile = false;
Point screenSize = new Point();
if(width == -1 || height == -1) {
mainActivity.getWindowManager().getDefaultDisplay().getSize(screenSize);
}
if(width == -1){
width = screenSize.x - 150;
}
if(height == -1){
height = screenSize.y - 150;
}
MobileIframeWebView.width = width;
MobileIframeWebView.height = height;
MobileIframeWebView.activity = mainActivity;
MobileIframeWebView.context = mainContext;
MobileIframeWebView.parentView = (AppFwkWebView)(MobileIframeWebView.activity.findViewById(R.id.sasappview));
MobileIframeWebView.client = client;
if (url.startsWith(PREFIX_WEB_URL_HTTP))
MobileIframeWebView.url = url;
else {
isLocalFile = true;
MobileIframeWebView.url = FileHelper.GetLocalFileURL(url);
// check if file exists
if (!FileHelper.DoesFileExist(url))
return;
// now check if the file needs to be opened in a browser, that is
// if the webview cannot open it
if (FileHelper.IsWebViewFileType(MobileIframeWebView.url)) {
startBrowserActivity(mainActivity, mainContext, MobileIframeWebView.url);
return;
}
}
MobileIframeWebView.javascriptInterface = javascriptInterface;
MobileIframeWebView.javascriptInterfaceName = javascriptInterfacename;
mainActivity.runOnUiThread(new Runnable() {
public void run() {
LayoutInflater inflater =LayoutInflater.from(MobileIframeWebView.context);
LinearLayout iframeLayout = (LinearLayout) inflater.inflate(R.layout.iframe_skeleton, null,false);
iframeLayout.setLayoutParams(new LinearLayout.LayoutParams(MobileIframeWebView.width,MobileIframeWebView.height));
MobileIframeWebView.popup = new PopupWindow(
iframeLayout,
MobileIframeWebView.width,
MobileIframeWebView.height,
true);
//show the iframe
MobileIframeWebView.openedIframe = (MobileIframeWebView) (iframeLayout.findViewById(R.id.view_iframe));
View emptySpace = (View) (iframeLayout.findViewById(R.id.empty_space_close_iframe));
ImageView closewv = (ImageView) (iframeLayout.findViewById(R.id.close_iframe));
int emptySpaceWidth = MobileIframeWebView.width - closewv.getLayoutParams().width;
if(emptySpaceWidth > 0)
emptySpace.getLayoutParams().width = emptySpaceWidth;
MobileIframeWebView.openedIframe.getSettings().setJavaScriptEnabled(true);
MobileIframeWebView.openedIframe.requestFocus(View.FOCUS_DOWN);
MobileIframeWebView.openedIframe.setWebViewClient(MobileIframeWebView.client);
MobileIframeWebView.openedIframe.setWebChromeClient(new WebChromeClient());
if(MobileIframeWebView.javascriptInterface != null)
MobileIframeWebView.openedIframe.addJavascriptInterface(MobileIframeWebView.javascriptInterface, MobileIframeWebView.javascriptInterfaceName);
MobileIframeWebView.openedIframe.loadUrl(MobileIframeWebView.url);
closewv.setOnTouchListener(new MobileIframeOnTouchListener(MobileIframeWebView.openedIframe));
MobileIframeWebView.popup.showAtLocation(MobileIframeWebView.activity.findViewById(R.id.frameLayout1), Gravity.CENTER, 0, 0);