Any URL is not loading using web view below 5.0 ve

2019-07-28 10:26发布

I have tried lots of way but still not getting solution actually my URL is working fine in 5.1.1 but when i checked in 4.4.2 its only displaying blank screen

public class WebViewTwo extends Activity {
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.web_view_two);
    webView = (WebView)findViewById(R.id.webView2);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webView.getSettings().setLoadsImagesAutomatically(true);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.setWebViewClient(new WebViewClient());
    webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.setWebChromeClient(new WebChromeClient());
    webView.loadUrl("www.google.co.in");
}

Here is my logcat error 07-21 12:26:13.053 2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44 07-21 12:26:13.064 2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0 07-21 12:26:13.167 2089-2104/com.ccc.dar E/eglCodecCommon﹕ **** ERROR unknown type 0x79edaef5 (glSizeof,72) 07-21 12:26:13.184 2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44 07-21 12:26:13.194 2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0 07-21 12:26:13.214 2089-2096/com.ccc.dar W/art﹕ Suspending all threads took: 22.429ms 07-21 12:26:13.238 2089-2104/com.ccc.dar E/eglCodecCommon﹕ **** ERROR unknown type 0x79edaef5 (glSizeof,72) 07-21 12:26:13.435 2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44 07-21 12:26:13.457 2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0 07-21 12:26:13.499 2089-2101/com.ccc.dar I/art﹕ Background sticky concurrent mark sweep GC freed 1125(118KB) AllocSpace objects, 1(16KB) LOS objects, 0% free, 5MB/5MB, paused 2.405ms total 145.580ms 07-21 12:26:13.584 2089-2104/com.ccc.dar E/eglCodecCommon﹕ **** ERROR unknown type 0x79edaef5 (glSizeof,72) 07-21 12:26:44.980 2089-2096/com.ccc.dar W/art﹕ Suspending all threads took: 11.554ms

2条回答
干净又极端
2楼-- · 2019-07-28 11:02

After research I got my answer and now its running smoothly on 4.4.2.

public class WebViewTwo extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.web_view_two);

    WebView webView = (WebView) findViewById(R.id.webView2);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new HelloWebViewClient());

    webView.loadUrl("http://www.google.co.in");
}

private class HelloWebViewClient extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {

        view.loadUrl(url);
        return true;
    }
}}
查看更多
别忘想泡老子
3楼-- · 2019-07-28 11:20

Replace code webView.setWebChromeClient(new WebChromeClient()); with webView.setWebChromeClient(new MyWebChromeClient()); Add following code -

private class MyWebChromeClient extends WebChromeClient {

        @Override
        public void onConsoleMessage(String message, int lineNumber, String sourceID) {
            Log.d(TAG, message + " -- From line "
                    + lineNumber + " of "
                    + sourceID);
        }
    }

check the console log. And also check whether your url is with http or https , so can handle accordingly. it is also happened with me once and issue was found of webpage.

查看更多
登录 后发表回答