【问题标题】:EGL_BAD_DISPLAY in android whilst debugging webviewandroid中的EGL_BAD_DISPLAY同时调试webview
【发布时间】:2016-10-19 20:44:36
【问题描述】:

在应用中的android中运行webview

错误是 EGL_BAD_DISPLAY。有一些关于herehere等问题的参考,但到目前为止这些问题都没有用(其中包括添加透明背景(参见.java)和硬件加速(参见.xml)。互联网在清单中启用了权限。

我在物理设备上调试,android 版本 5.0.2,三星平板 Tab 4。

调试错误日志

10-19 16:32:58.757 28363-28363/? E/Zygote: MountEmulatedStorage()
10-19 16:32:58.757 28363-28363/? E/Zygote: v2
10-19 16:32:58.767 28363-28363/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
10-19 16:33:03.267 28363-28657/com.amazon.mysampleapp E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)

.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_demo_home);

    WebView myWebView = (WebView) findViewById(R.id.webview);
    myWebView.setBackgroundColor(0x00000000);
    myWebView.getSettings().setJavaScriptEnabled(true);
    myWebView.setWebViewClient(new WebViewClient());
    myWebView.loadUrl("file:///android_asset/MyMap8.html");
    myWebView.setBackgroundColor(0x00000000);

    // Other AWS gibberish

.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_centerVertical="true"
              android:layout_width="match_parent"
              android:layout_height="match_parent">


    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="500dp"
        >

    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@android:id/list"
        />
</LinearLayout>

【问题讨论】:

    标签: android webview


    【解决方案1】:

    解决方案是使用 WebChromeClient (import android.webkit.WebChromeClient;) 而不是 WebViewClient

    【讨论】:

    • 我遇到了同样的问题。我尝试使用 WebChormeClient。但它仍然无法加载。
    • 或者你可以同时使用:)
    • WebChromeClient 没有帮助,还是同样的错误
    猜你喜欢
    • 2022-01-19
    • 2012-05-17
    • 2011-06-19
    • 1970-01-01
    • 2021-01-11
    • 1970-01-01
    • 2017-07-30
    • 2013-12-22
    • 2016-09-01
    相关资源
    最近更新 更多