Android 10 crashing completely when opening Ionic Capacitor app

Some Android 10 phones crash when opening the app, it does work as expected on Android 11, here are the logs, I cant find the problem:

Connected to process 1151 on device 'Pixel_2_API_29 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/com.example.ap: Late-enabling -Xcheck:jni
E/com.example.ap: Unknown bits set in runtime_flags: 0x8000
W/com.example.ap: Unexpected CPU variant for X86 using defaults: x86
D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
E/com.example.ap: Invalid ID 0x00000000.
W/RenderThread: type=1400 audit(0.0:86574): avc: denied { write } for name="property_service" dev="tmpfs" ino=9470 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0
W/com.example.ap: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
W/com.example.ap: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
I/WebViewFactory: Loading com.google.android.webview version 74.0.3729.185 (code 373018518)
I/com.example.ap: The ClassLoaderContext is a special shared library.
I/com.example.ap: The ClassLoaderContext is a special shared library.
I/cr_LibraryLoader: Time to load native libraries: 17 ms (timestamps 1666-1683)
E/com.example.ap: Invalid ID 0x00000000.
E/com.example.ap: Invalid ID 0x00000000.
I/chromium: [INFO:library_loader_hooks.cc(50)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader: Expected native library version number "74.0.3729.185", actual native library version number "74.0.3729.185"
W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.google.android.webview, sandboxed = true
W/com.example.ap: Accessing hidden method Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z (greylist, reflection, allowed)
I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
W/System.err: java.lang.RuntimeException: android.os.DeadSystemException
W/System.err:     at android.os.UserManager.getApplicationRestrictions(UserManager.java:3051)
W/System.err:     at Sw.a(PG:6)
W/System.err:     at Sw.b(PG:20)
W/System.err:     at org.chromium.policy.CombinedPolicyProvider.linkNative(PG:10)
W/System.err:     at org.chromium.content.app.ContentMain.nativeStart(Native Method)
W/System.err:     at org.chromium.content.app.ContentMain.a(PG:2)
W/System.err:     at org.chromium.content.browser.BrowserStartupControllerImpl.a(PG:51)
W/System.err:     at org.chromium.android_webview.AwBrowserProcess.a(PG:154)
W/System.err:     at zi.run(Unknown Source:2)
W/System.err:     at org.chromium.base.ThreadUtils.a(PG:10)
W/System.err:     at org.chromium.android_webview.AwBrowserProcess.a(PG:48)
W/System.err:     at kv.c(PG:90)
W/System.err:     at kv.b(PG:160)
W/System.err:     at kv.a(PG:141)
W/System.err:     at com.android.webview.chromium.WebViewChromiumFactoryProvider.a(PG:234)
W/System.err:     at com.android.webview.chromium.WebViewChromium.init(PG:44)
W/System.err:     at android.webkit.WebView.<init>(WebView.java:429)
W/System.err:     at android.webkit.WebView.<init>(WebView.java:353)
W/System.err:     at android.webkit.WebView.<init>(WebView.java:336)
W/System.err:     at android.webkit.WebView.<init>(WebView.java:323)
W/System.err:     at com.getcapacitor.CapacitorWebView.<init>(CapacitorWebView.java:16)
W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
W/System.err:     at android.view.LayoutInflater.createView(LayoutInflater.java:854)
W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
W/System.err:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
W/System.err:     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
W/System.err:     at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696)
W/System.err:     at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170)
W/System.err:     at com.getcapacitor.BridgeActivity.onCreate(BridgeActivity.java:28)
W/System.err:     at android.app.Activity.performCreate(Activity.java:7802)
W/System.err:     at android.app.Activity.performCreate(Activity.java:7791)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
W/System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
W/System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
W/System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
W/System.err:     at android.os.Looper.loop(Looper.java:214)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7356)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
W/System.err: Caused by: android.os.DeadSystemException
W/System.err: 	... 49 more
A/chromium: [FATAL:jni_android.cc(249)] Please include Java exception stack in crash report
A/libc: Fatal signal 5 (SIGTRAP), code 128 (SI_KERNEL), fault addr 0x0 in tid 1151 (com.example.app), pid 1151 (com.example.app)
E/AndroidRuntime: FATAL EXCEPTION: GoogleApiHandler
    Process: com.example.app, PID: 1151
    DeadSystemException: The system died; earlier logs will point to the root cause

A/chromium: [FATAL:jni_android.cc(249)] Please include Java exception stack in crash report
A/libc: Fatal signal 5 (SIGTRAP), code 128 (SI_KERNEL), fault addr 0x0 in tid 1151 (com.example.app), pid 1151 (com.example.app)
E/AndroidRuntime: FATAL EXCEPTION: GoogleApiHandler
    Process: com.example.app, PID: 1151
    DeadSystemException: The system died; earlier logs will point to the root cause

Sometimes it also gives this error:

E/chromium: [ERROR:gl_surface_egl.cc(342)] eglChooseConfig failed with error EGL_SUCCESS

Here my package.json

{
  "name": "dataWork",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "resources": "capacitor-resources -p android,ios"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^13.3.0",
    "@angular/cdk": "^13.3.1",
    "@angular/common": "~13.2.2",
    "@angular/core": "~13.2.2",
    "@angular/forms": "~13.2.2",
    "@angular/material": "^13.3.1",
    "@angular/platform-browser": "~13.2.2",
    "@angular/platform-browser-dynamic": "~13.2.2",
    "@angular/router": "~13.2.2",
    "@awesome-cordova-plugins/background-mode": "^5.41.0",
    "@awesome-cordova-plugins/core": "^5.40.0",
    "@awesome-cordova-plugins/media-capture": "^5.40.0",
    "@capacitor/android": "3.4.3",
    "@capacitor/app": "1.1.1",
    "@capacitor/camera": "^1.3.1",
    "@capacitor/core": "^3.4.3",
    "@capacitor/filesystem": "^1.1.0",
    "@capacitor/haptics": "1.1.4",
    "@capacitor/ios": "3.4.3",
    "@capacitor/keyboard": "1.2.2",
    "@capacitor/status-bar": "1.0.8",
    "@capacitor/storage": "^1.2.5",
    "@fortawesome/angular-fontawesome": "^0.10.2",
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@fortawesome/free-solid-svg-icons": "^6.1.1",
    "@ionic-native/core": "^5.36.0",
    "@ionic-native/image-picker": "^5.36.0",
    "@ionic-native/splash-screen": "^5.36.0",
    "@ionic-native/status-bar": "^5.36.0",
    "@ionic/angular": "^6.0.14",
    "@ionic/cordova-builders": "^6.1.0",
    "@ionic/core": "^6.0.14",
    "@ionic/pwa-elements": "^3.1.1",
    "chart.js": "^3.7.1",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-media-capture": "^3.0.3",
    "cordova-plugin-telerik-imagepicker": "^2.3.6",
    "cordova-res": "^0.15.4",
    "ionicons": "^6.0.1",
    "moment": "^2.29.2",
    "ng-circle-progress": "^1.6.0",
    "ngx-show-hide-password": "^2.6.1",
    "rxjs": "~6.6.0",
    "rxjs-compat": "^6.6.7",
    "timer-node": "^5.0.5",
    "tslib": "^2.2.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.2.3",
    "@angular-eslint/builder": "~13.0.1",
    "@angular-eslint/eslint-plugin": "~13.0.1",
    "@angular-eslint/eslint-plugin-template": "~13.0.1",
    "@angular-eslint/template-parser": "~13.0.1",
    "@angular/cli": "~13.2.3",
    "@angular/compiler": "~13.2.2",
    "@angular/compiler-cli": "~13.2.2",
    "@angular/language-service": "~13.2.2",
    "@capacitor/cli": "^3.4.3",
    "@ionic/angular-toolkit": "^6.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "5.3.0",
    "@typescript-eslint/parser": "5.3.0",
    "cordova-android": "^10.1.1",
    "cordova-plugin-androidx": "^3.0.0",
    "cordova-plugin-androidx-adapter": "^1.1.3",
    "cordova-plugin-background-mode": "^0.7.3",
    "cordova-plugin-badge": "^0.8.8",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-dialogs": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~3.8.0",
    "jasmine-spec-reporter": "~5.0.0",
    "jetifier": "^2.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.4.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-local-notification": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-background-mode": {},
      "cordova-plugin-androidx-adapter": {},
      "cordova-plugin-dialogs": {}
    },
    "platforms": [
      "android"
    ]
  }
}

Are you able to reproduce the error consistently on Android 10? Usually, a DeadSystemException is thrown when Android OS itself has an error and it tries to kill all apps so it’s not uncommon to get it every once in a while if you have a large install base

It happens everytime. However I tried compiling with cordova and aparently works. Lots of other things stoped working… But the app isnt restarting the phone now.

If you can make a small, reproducible example app, you should open an issue on the Capacitor GitHub repo and the team can take a look at it. I haven’t heard of others running into this issue so maybe you’ll figure out the issue when making a reproducible example!