Hello Expert Android Developers:
We have an android app and our basic workflow is as below
Problem As soon as the OK button is tapped on the webview where our native app page would launch normally until a few weeks ago, the app crashes and we would be taken back to the start of the webview page asking us to enter the details.
Please note the below caveats:
Here is a code snippet that may help - This is how we are loading the webview.
webview = findViewById(R.id.webview);
webview.setVisibility(View.VISIBLE);
final ProgressDialog pd = ProgressDialog.show(ActivtyName.this, "", "Please wait", true);
webview.setGeolocationEnabled(true);
webview.setMixedContentAllowed(true);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.setWebChromeClient(new WebChromeClient()
=======We override a lot of methods here followed by
webview.setWebViewClient(new WebViewClient()
=======We override methods here.
Any idea what might be going on? We have tried looking at the logs while debugging via USB mode, but we don't see much in logs except what is shown on the Android Console like below:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.a****d.xyzapp <<<
backtrace:
#00 pc 0000000001b61620 /data/app/com.android.chrome-DpcaMBOCm2oa08upmw1Tug==/base.apk
Here is the more detailed log as requested:
2019-05-18 11:58:01.694 23217-23217/com.a**d.xyzapp.debug A/chromium:
[FATAL:crashpad_client_linux.cc(404)] Render process (28925)'s crash wasn't handled by all associated webviews, triggering application crash.
Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x7ab7b9d620 in tid 23217 (atientapp.debug), pid 23217 (atientapp.debug) (edited)
In your case Render process is crashing and it is not killed by the system.
So as described here, if you override
onRenderProcessGone(WebView view,
RenderProcessGoneDetail detail)
above method then detail.didCrash()
will holds true
in your case. In that case, Renderer crashed because of an internal error, such as a memory access violation. The app itself crashes after detecting that the renderer crashed.
To handle the crash and allow your app to continue executing, you should follow the below steps:-
onRenderProcessGone
and return true.Problem As soon as the OK button is tapped on the webview where our native app page would launch normally until a few weeks ago, the app crashes and we would be taken back to the start of the webview page asking us to enter the details.
This is because if a renderer crashes while loading a particular web page, attempting to load that same page again could cause a new WebView
object to exhibit the same rendering crash behaviour.
Check code in this link for more info.
Hope this will help.
Are you using mopub advertising platform? if so they have this bug associated with their sdk.
It is usually related to bug in web-page that is being tried to load.
There is also change in the way webview works from android 8.0 above. It is now multi-process based, which also gives you power to handle these kind of errors(renderer gone, out of memory and many others).
You should implement this override
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail)
More detail about this is here
Update: If you are using mopub or even webview, Android 9.0 blocks all non-https traffic. Consider using alternate way like mopub has implemented here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With