One option is to use process of elimination. Comment out sections of code, test it out, comment out more sections, and repeat until you narrow down the section of code that’s causing the issue.
Thanks. I have attempted that a couple of times. But as it needs a complete rebuild, download and install, it is extremely slow. Plus builds on expo site queues for about 30mins (even at odd hours).
Only manageable way is to find out how to capture the error.
You should be able to see the crash using adb logcat.
But there is a bug causing crashes on Android when in dark mode. Dark mode on Android was introduced in SDK 36, so if this started after upgrading that might be the cause.
I think I was able to track the faulty line. I’ve this line in a file (outside component which is why it was crashing at startup; putting in render causes error in just that screen)
Expo encountered a fatal error: TypeError: undefined is not an object (evaluating ‘h.default.manifest.android.config.googleMaps’), stack: @1307:533 v@2:1474 @1253:1789 v@2:1474 @1252:307 v@2:1474 @953:200 v@2:1474 @663:312 v@2:1474 @6:82 v@2:1474 d@2:876 global code@1505:4
I inspected in expo client, both properties work perfectly. Need to figure out why it’s crashing on android standalone (didn’t verify in ios standalone).
One thing I’m not sure of, though: How safe is it putting things like Google Maps API key in the manifest? I suppose there’s nowhere else to put them, but is it a problem if the user unpacks the APK and gets the API key from it?
We have had identical symptoms as you describe (crashing on launch on Android, only in builds, not in dev, ever since upgrading to SDK36). Just wanted to pass along that we have tracked it down to dark mode on Android. If we disable dark mode and reinstall the app, then it works. This has been our workaround for our customers until we can track the root cause.
That’s a good question. I had a cred in JS config until I realized anyone read it and find it there. That’s why I thought only safe place is app.json as we already have other creds as instructed by Expo. I need to find out if that’ll be safe!
Also I guess the reason, it broke in standalone, is that during build expo removes (i guess moves to somewhere else) it (may be selective ones) from app.json as they said
Most configuration from app.json is accessible at runtime from your JavaScript code via Constants.manifest. Sensitive information such as secret keys are removed. See the "extra" key below for information about how to pass arbitrary configuration data to your app.
Another thing, I’ve tried to use adb logcat. Though I saw the exception there it wasn’t much helpful. I tried to configure the crashlytics and had to give up midway. Not sure how (i guess because I already have the firebase setup for other purpose), later I got a notification about the crash and exact problem.