Android Gecko: App crashes due to a SIGSEGV error in libxul.so

3D WebView for Android with Gecko Engine embeds the Mozilla GeckoView library, and there are a couple of scenarios that can cause Gecko to crash:

If you're encountering a crash with Android Gecko, please try the tips in on this page to resolve the issue. If the crash still persists after trying the steps described on this page, please contact me.

Large APK issue

GeckoView currently has a bug where if the app's APK is large (> 1 GB), it can cause Gecko to crash. This issue has been reported to Mozilla. To avoid the issue, please enable "Split Application Binary" in Android Player Settings -> Publishing Settings. For reference, here's an example of what the stack trace in the Logcat logs looks like when the crash occurs:

FATAL EXCEPTION: UnityMain
Process: com.vuplex.example, PID: 11233
java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version '2019.4.18f1 (3310a4d4f880)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
Build fingerprint: 'google/blueline/blueline:11/RQ3A.210905.001/7511028:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2021-11-19 01:47:53-0500
pid: 11233, tid: 11354, name: GeckoMain  >>> com.vuplex.example <<<
uid: 10373
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
    x0  0000006c505fb9bc  x1  0000006c18ffa9d4  x2  0000000000000016  x3  0000006c5000454c
    x4  0000006c18ffa9ea  x5  0000006c505fb9f8  x6  524f5252455f534e  x7  4156415f544f4e5f
    x8  0000000000000000  x9  0000006c505fb988  x10 0000000000000552  x11 0000000000000010
    x12 415f544f4e5f524f  x13 454c42414c494156  x14 00000000e36faef3  x15 00000000a3ffb593
    x16 0000006c505f8528  x17 0000007061d0a2c0  x18 0000006c17eb4000  x19 0000006c18ffaa58
    x20 0000006c18ffc000  x21 0000006c50125560  x22 0000006c50125568  x23 0000006c18ffc000
    x24 0000000000000000  x25 0000006c18ffc000  x26 000000007ffffff5  x27 0000006c160cd000
    x28 0000006c18ffafa0  x29 0000006c13fd6488
    sp  0000006c18ffa9b0  lr  0000006c12493f9c  pc  0000006c12494020

backtrace:
      #00 pc 0000000003a52020  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libxul.so (BuildId: 33997e2aac491bea1bf3cfc0e372c55afb60d7fc)
      #01 pc 00000000025b0f2c  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libxul.so (BuildId: 33997e2aac491bea1bf3cfc0e372c55afb60d7fc)
      #02 pc 0000000003325ac0  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libxul.so (BuildId: 33997e2aac491bea1bf3cfc0e372c55afb60d7fc)
      #03 pc 000000000367e3ac  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libxul.so (BuildId: 33997e2aac491bea1bf3cfc0e372c55afb60d7fc)
      #04 pc 0000000002e87670  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libxul.so (BuildId: 33997e2aac491bea1bf3cfc0e372c55afb60d7fc)
      #05 pc 0000000002e835e8  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libxul.so (BuildId: 33997e2aac491bea1bf3cfc0e372c55afb60d7fc)
      #06 pc 0000000002e85008  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libxul.so (BuildId: 33997e2aac491bea1bf3cfc0e372c55afb60d7fc)
      #07 pc 0000000002e867d4  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libxul.so (GeckoStart+80) (BuildId: 33997e2aac491bea1bf3cfc0e372c55afb60d7fc)
      #08 pc 000000000006be24  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/lib/arm64/libmozglue.so (Java_org_mozilla_gecko_mozglue_GeckoLoader_nativeRun+568) (BuildId: 72761c5b01c6f39efff2747d185c80d700d3e3f8)
      #09 pc 00000000000123d0  /data/app/~~iIpjyPSYrPaLnSBV3kL_4g==/com.vuplex.example-D2J60etGFAWKkQBDtFCLsg==/oat/arm64/base.odex

Development mode issue

In some cases, Gecko can crash if "Development Build" is enabled in Build Settings. To resolve the issue, please disable the "Development Build" option. For reference, here's an example of what the stack trace in the Logcat logs looks like when the crash occurs:

FATAL EXCEPTION: UnityMain
Process: com.vuplex.example, PID: 10252
java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version '2021.2.16f1 (559fc0ec6670)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
Build fingerprint: 'oculus/hollywood/hollywood:10/QQ3A.200805.001/28467500769800000:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2022-05-27 13:22:17-0500
pid: 10252, tid: 10654, name: WRRenderBackend  >>> com.vuplex.example <<<
uid: 10101
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x6e2a3f1fe0
    x0  0000006e2a3f2000  x1  0000006ef840cdf8  x2  0000006ef840a580  x3  0000006e2a3f2158
    x4  0000006ef840a580  x5  0000006e2a3f2120  x6  0000006ef840cdf8  x7  0000006e2a5f0ea8
    x8  0000006ef667fa38  x9  0000006ef8410e08  x10 0000006e2a3f2030  x11 0000006ef5b109e8
    x12 0000006e2a3f2040  x13 0000006ef8410ef0  x14 00000000ffffffff  x15 0000000042100000
    x16 0000006ef84162a0  x17 00000071a8356f34  x18 0000006e28b52000  x19 0000006ef8455c88
    x20 0000006ef8455000  x21 0000006ef840cdf8  x22 0000006e2a3f2410  x23 00000000000009b7
    x24 0000006e2096fa10  x25 0000006e5f2ac15c  x26 fffffffffffffffd  x27 0000006e5f08bb50
    x28 0000000000000080  x29 fefefefefefefeff
    sp  0000006e2a3f1fc0  lr  0000006ef3f1a0b4  pc  0000006ef5ab79b0

backtrace:
      #00 pc 00000000047689b0  /data/app/com.vuplex.example-OgYWjPp000uy6MorJRTmiA==/lib/arm64/libxul.so (BuildId: 40d604ec300375fa30214c3e71117778042a76ed)
      #01 pc 0000000002bcb0b0  /data/app/com.vuplex.example-OgYWjPp000uy6MorJRTmiA==/lib/arm64/libxul.so (BuildId: 40d604ec300375fa30214c3e71117778042a76ed)

	at libxul.0x47689b0(Native Method)
	at libxul.0x2bcb0b0(Native Method)