Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Webview Unknown Error

I have made an app that uses WebView. It works, however, the LogCat produces this error:

03-27 10:36:35.830: E/eglCodecCommon(1466): **** ERROR unknown type 0x0 (glSizeof,73)

I understand that 0x0 is an unknown error type (in Linux command), but how can I fix this?
My Java code is:

@SuppressLint("SetJavaScriptEnabled")
public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    private WebView edlineWebView;
    private ProgressBar progressBar1;
    private String currentUrl;
    private boolean exitConfirmation;
    private BroadcastReceiver completeReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Resources res = context.getResources();
            Toast.makeText(context, res.getString(R.string.download_complete), Toast.LENGTH_SHORT).show();
            startActivity(new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS));
        }
    };

    final Activity activity = this;

    @Override
    public void onBackPressed() {
        if (edlineWebView.copyBackForwardList().getCurrentIndex() > 0) {
            edlineWebView.goBack();
        }    
        else {
            if (exitConfirmation) {
                super.onBackPressed();
                return;
            }

            this.exitConfirmation = true;
            Toast.makeText(this, "Press the back key again to exit", Toast.LENGTH_SHORT).show();

            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    exitConfirmation=false;                       
                }
            }, 2000);
        }
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().requestFeature(Window.FEATURE_PROGRESS);
        setContentView(R.layout.activity_main);

        edlineWebView = (WebView) findViewById(R.id.webView1); 
        progressBar1 = (ProgressBar) findViewById(R.id.progressBar1);
        String url = "http://www.edline.net/";

        edlineWebView.setWebViewClient(new WebViewClient());
        edlineWebView.getSettings().setJavaScriptEnabled(true);
        edlineWebView.getSettings().setUserAgentString("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3");
        edlineWebView.loadUrl(url);
        edlineWebView.setDownloadListener(new DownloadListener() {
            @SuppressLint("DefaultLocale")
            @Override
            public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
                MimeTypeMap mtm = MimeTypeMap.getSingleton();
                DownloadManager downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
                Uri downloadUri = Uri.parse(url);
                String fileName = downloadUri.getLastPathSegment();
                int pos = 0;

                if ((pos = contentDisposition.toLowerCase().lastIndexOf("filename=")) >= 0) {
                    fileName = contentDisposition.substring(pos + 9);
                    pos = fileName.lastIndexOf(";");
                    if (pos > 0) {
                        fileName = fileName.substring(0, pos - 1);
                    }
                }

                String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toLowerCase();
                String mimeType = mtm.getMimeTypeFromExtension(fileExtension);
                Request request = new DownloadManager.Request(downloadUri);
                request.setTitle(fileName);
                request.setDescription(url);
                request.setMimeType(mimeType);  
                request.setDestinationInExternalPublicDir( Environment.DIRECTORY_DOWNLOADS, fileName);
                Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS).mkdirs();
                downloadManager.enqueue(request);
            }
        });

        currentUrl = url;
        edlineWebView.setWebChromeClient(new WebChromeClient() 
        {  
            public void onProgressChanged(WebView view, int progress) 
            {  
                if (progress<100)
                {
                    progressBar1.setVisibility(ProgressBar.VISIBLE);
                }
                else if (progress==100)
                {
                    progressBar1.setVisibility(ProgressBar.GONE);              
                }
                progressBar1.setProgress(progress);  
            }
        });

        edlineWebView.setWebViewClient(new WebViewClient() 
        {
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                // TODO Auto-generated method stub
                super.onPageStarted(view, url, favicon);
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                currentUrl = edlineWebView.getUrl();
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                // TODO Auto-generated method stub
                view.loadUrl(url);
                return true;
            }
        });
    }

    @Override
    protected void onPause() {
        super.onPause();
        unregisterReceiver(completeReceiver);
    }

    @Override
    protected void onResume() {
        IntentFilter completeFilter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
        registerReceiver(completeReceiver, completeFilter);
        super.onResume();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch(item.getItemId()) {
        case R.id.goto_browser:
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(currentUrl));
            startActivity(i);

            return true;
        }
        return false;
    }
}
like image 240
jyoonPro Avatar asked Mar 27 '14 10:03

jyoonPro


People also ask

How do I fix err unknown URL scheme in Android WebView?

You may get this "ERR_UNKNOWN_URL_SCHEME error" during mailto: or tel: links inside an iframe. To solve it, try to add target="_blank" in your URL Scheme/Code.

How do I fix unknown URL scheme?

Another method is to edit the URL href code and add target=”_blank” in a roundabout way to open a new window with the link. Adding new intents with URL schemes is another way to fix the error as intents inform the Android device about what the users intend for the application to do.

Why is my WebView not working?

You might often face issues in updating the chrome and Android System Webview. To fix this problem, you can reboot your device, check your internet connection, stop auto-updating all apps, clear Google Playstore cache, and storage, leave the beta testing program, and manually update Android WebView app from Playstore.

Is Android WebView deprecated?

This interface was deprecated in API level 12. This interface is now obsolete.


1 Answers

In my case, I loaded a site which contains an Image slider. The logcat produces this same error code when the slider changes the images. I assume this happens, because the webpage computes the size of the screen of my device. I am just guessing, because it's from gl:

05-03 10:15:25.149: E/eglCodecCommon(5081): **** ERROR unknown type 0x1 (glSizeof,73)
like image 169
Sripathi Avatar answered Oct 17 '22 11:10

Sripathi