Android System WebView crashes Android apps! “Tomb

2019-02-03 08:39发布

问题:

EDIT: It turns out it wasnt Chrome but Android System WebView. Several other users on Google Play Store have left responses such as Crashes apps without any error.

Original post:

Tonight my Chrome app updated (Android 5.0.2) and when I try to build my Xamarin Android app in DEBUG mode I get the error:

[google-breakpad] ### ### ### ### ### ### ### ### ### ### ### ### ###

[google-breakpad] Chrome build fingerprint:

[google-breakpad] 1.0

[google-breakpad] 1

[google-breakpad] 5c230f07-455f-4c1f-91eb-9c44019cd813

[google-breakpad] ### ### ### ### ### ### ### ### ### ### ### ### ###

[google-breakpad] Tombstones are disabled on JB MR2+ user builds.

[google-breakpad] ### ### ### ### ### ### ### ### ### ### ### ### ###

In the console I can find the error message:

E/SysUtils﹕ ApplicationContext is null in ApplicationStatus

Which seems to be part of chromium.

The error shows in the console and the app returns to back (but is not destroyed) when the webview returns it seems. The webview is issued in another framework.

I have done no changes since yesterday, when everything worked.

After building (and crashing) running the app from the device functions as excepted.

My target build version is API 21 and API minimum is 14 (but it also fails at 19).

回答1:

I filed a chromium bug for what seems to be the underlying cause. http://code.google.com/p/chromium/issues/detail?id=481420



回答2:

It turns out it was not Chrome but Android System WebView that caused the app to crash. Several other users on Google Play Store have left responses such as Crashes apps without any error.

EDIT:

Jonathan Pryor on Xamarin Bugzilla posted this comment:

As mentioned in Comment #2 and Comment #3, the problem is that the Google Play Service WebView and related types is clobbering existing SIGSEGV handlers, which screws things up for all native code which relies on signal handlers (e.g. Houdini).

As a workaround, it is possible to remove the need for a SIGSEGV handler for NullReferenceException raising, by setting the MONO_DEBUG variable to contain the value "explicit-null-checks":

http://docs.go-mono.com/?link=man%3amono(1)

This can be done by adding a file to your App project with a Build action of AndroidEnvironment:

http://developer.xamarin.com/guides/android/advanced_topics/environment/

Then adding the following line to the file:

MONO_DEBUG=explicit-null-checks


回答3:

You can uninstall the WebView updates, so you can work on your project while this is fixed.

We found out that in our case it crashed when an exception was thrown. If we used Java.Lang.Exception instead of the C# Exceptions, it stopped crashing.



回答4:

I found a fix for Unity. It's been verified and tested.

1) Install this script under Under YOUR_UNITY_PROJECT/Assets/Editor (Credits to Prime31 for this awesome script):

https://github.com/prime31/P31UnityAddOns/blob/master/Editor/GlobalDefinesWizard.cs

2) As @fhl mentioned, you need to add MONO_DEBUG=explicit-null-checks to the global defines, you can do so by clicking your newly-added global defines tag, and make sure it looks like this:

3) Now make a new build, and it should fix your crash.