Hey everyone,
we’ve been battling a nasty crash in our Ionic + Capacitor 7 app, that’s been tanking our otherwise flawless crash rate on Google play. I figured I’d post this here in case it saves someone else the headache.
The issue
-
On Android, when using the
@capacitor/Cameraplugin and callingCamera.getPhoto()(or similar APIs that spin up the WebView renderer), some users hit hard native crashes inside the TrichromeLibrary (libmonochrome_64.so). -
The crash originates from the system’s Android System WebView / Chrome Trichrome package, so it’s not something we as app devs directly control.
-
In Google Play Console, these show up as
com.google.android.trichromelibrarycrashes and can wreck your crash-free stats (Google even threatens reduced visibility if your crash rate is high).
What we found
-
It’s not tied to Capacitor or Ionic versions specifically (we saw it even after updating everything to Capacitor 7).
-
It’s caused by bugs in certain Trichrome / WebView releases.
-
It’s random and device-dependent, which makes it extra frustrating.
Workarounds / Mitigation
-
Explicitly include the latest androidx.webkit in
app/build.gradleso you’re not stuck on an older system default:implementation "androidx.webkit:webkit:1.12.1" -
Ideally add a WebView listener to catch renderer process deaths instead of letting the whole app die.
-
Add a cooldown on reloads to avoid endless crash loops.
-
Things to note -
reloadin MainActivity doesn’t work, the activity becomes too corrupted, same withrecreate… the only thing that helped was killing the process and a complete hard restart -
But honestly in the end, just like us, you will probably have to migrate from a plugin that opens a new intent to open the camera to a plugin that just opens the camera in your own MainActivity‘s intent (we went with
@capgo/camera-preview)
Reality check
This seems to be a Google WebView/Trichrome bug. It does not happen on iOS it has something to do with opening the new intent for the camera, it seems like the process starts running low on memory and just crashes. Despite many many efforts to downscale images and not perform anything memory heavy in our code, it would randomly crash again and again. It does not happen for opening gallery, only for taking an image. It seems like the intent handoff just sometimes doesn’t happen right, the camera always would open but then coming back - changing intents and properly closing, that’s where u crash.
What we had to do eventually
For android image capture we had to implement @capgo/camera-preview as that one doesn’t open new intent and just runs in your already created activity. That seemed to have fixed the issue but obviously it’s not ideal as now we have to maintain two approaches.
If you’ve seen similar crashes in your app, you’re not alone. Hopefully Google stabilizes Trichrome soon, but until then, these mitigations can help and save your Play Store stats.