javascript – Android webview crash "Fatal signal 5 (SIGTRAP)"-ThrowExceptions

Exception or error:

I have an app with a webview in which I load HTML content with javascript enabled. The webview is inside a fragment.

This is how I initialize the webview inside the method onCreateView of the fragment :

WebView webview = (WebView) mainView.findViewById(;

WebSettings webSettings = webview.getSettings();


webview.setWebViewClient(new WebViewClient() {
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            * My code

webview.setWebChromeClient(new WebChromeClient() {
        public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
            WebView.HitTestResult result = view.getHitTestResult();
            String data = result.getExtra();
            if (data != null) {
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(data));
            return false;

webview.loadDataWithBaseURL(baseUrl, htmlData, "text/html", "utf-8", "");

In the webview, a map is loaded with javascript. On this map, we can click on elements and load photos. When clicked, the photo is displayed in a popup (still inside the webview). When I click on the back button to go back to the map, the app crashes.

GIF of the crash in app

Here is the error log :

A/libc: Fatal signal 5 (SIGTRAP), code 1 in tid 949 (Chrome_InProcRe)
    [ 03-21 11:26:08.510   364:  364 W/         ]
    debuggerd: handling request: pid=32610 uid=10289 gid=10289 tid=949

I tested and got the crash on Android 7.1.1 , 6.0.1, 5.0.2. Then I tried with Android 4.4.2 and the app didn’t crash.

When I click on the back button (as we can see on the GIF), it should go back to the previous state with the popup closed

How to solve:

Try this….

First add this

webView.setWebViewClient(new MyBrowser());

and then add this

public class MyBrowser extends WebViewClient {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // TODO Auto-generated method stub

            if (url.equals(""YOUR URL)) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                return true;
            } else {
                return false;



Leave a Reply

Your email address will not be published. Required fields are marked *