Standalone Crashing on Startup (iOS and Android)

Please provide the following:

  1. SDK Version: 39
  2. Platforms(Android/iOS/web/all): iOS & Android

Upgraded from SDK35 to SDK39. Everything runs smoothly on development (Expo APP), but standalone app crashes on startup right after the Splash Screen is shown both on Simulator and TestFlight.

Not sure if this would be relevant, but I started using Typescript in the upgrade process.

Here is the crash log from the Simulator:

Date/Time:             2020-12-10 11:16:40.444 -0600
OS Version:            Mac OS X 10.15.7 (19H15)
Report Version:        12
Anonymous UUID:        933A5BAC-04AF-4FCB-B31C-ED62AA9E1A41

Sleep/Wake UUID:       3F2DCD78-5BEC-4FDA-9242-AF96D1F82828

Time Awake Since Boot: 180000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception 'ExpoFatalError', reason: 'Expo encountered a fatal error: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'x.Native.init')'
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 732.18.0.2 - Device: iPhone 12 Pro Max (B8B15A0A-6837-44FD-9C4B-84AF21A94D48) - Runtime: iOS 14.2 (18B79) - DeviceType: iPhone 12 Pro Max

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff2041daf2 __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x00007fff20177e78 objc_exception_throw + 48
2   ComMyAppCensored                   0x00000001069d3411 -[EXAppViewController maybeShowError:] + 506
3   ComMyAppCensored                   0x00000001069f550d handleFatalReactError_block_invoke_2 + 574
4   libdispatch.dylib                   0x00007fff20106508 _dispatch_client_callout + 8
5   libdispatch.dylib                   0x00007fff20113c9a _dispatch_async_and_wait_invoke + 109
6   libdispatch.dylib                   0x00007fff20106508 _dispatch_client_callout + 8
7   libdispatch.dylib                   0x00007fff20112ff7 _dispatch_main_queue_callback_4CF + 1045
8   CoreFoundation                      0x00007fff2038bdab __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
9   CoreFoundation                      0x00007fff2038662e __CFRunLoopRun + 2685
10  CoreFoundation                      0x00007fff203856c6 CFRunLoopRunSpecific + 567
11  GraphicsServices                    0x00007fff2b76adb3 GSEventRunModal + 139
12  UIKitCore                           0x00007fff24675187 -[UIApplication _run] + 912
13  UIKitCore                           0x00007fff2467a038 UIApplicationMain + 101
14  ComMyAppCensored                   0x00000001067b4010 main + 80
15  libdyld.dylib                       0x00007fff20256409 start + 1

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff5e70733a __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff5e73ce60 pthread_kill + 430
2   libsystem_c.dylib             	0x00007fff200fac2e __abort + 139
3   libsystem_c.dylib             	0x00007fff200faba3 abort + 135
4   libc++abi.dylib               	0x00007fff2024f818 abort_message + 231
5   libc++abi.dylib               	0x00007fff20240e7d demangling_terminate_handler() + 266
6   libobjc.A.dylib               	0x00007fff201780d1 _objc_terminate() + 96
7   libc++abi.dylib               	0x00007fff2024ec47 std::__terminate(void (*)()) + 8
8   libc++abi.dylib               	0x00007fff2024ebe9 std::terminate() + 41
9   libdispatch.dylib             	0x00007fff2010651c _dispatch_client_callout + 28
10  libdispatch.dylib             	0x00007fff20113c9a _dispatch_async_and_wait_invoke + 109
11  libdispatch.dylib             	0x00007fff20106508 _dispatch_client_callout + 8
12  libdispatch.dylib             	0x00007fff20112ff7 _dispatch_main_queue_callback_4CF + 1045
13  com.apple.CoreFoundation      	0x00007fff2038bdab __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
14  com.apple.CoreFoundation      	0x00007fff2038662e __CFRunLoopRun + 2685
15  com.apple.CoreFoundation      	0x00007fff203856c6 CFRunLoopRunSpecific + 567
16  com.apple.GraphicsServices    	0x00007fff2b76adb3 GSEventRunModal + 139
17  com.apple.UIKitCore           	0x00007fff24675187 -[UIApplication _run] + 912
18  com.apple.UIKitCore           	0x00007fff2467a038 UIApplicationMain + 101
19  com.my.app           	0x00000001067b4010 main + 80
20  libdyld.dylib                 	0x00007fff20256409 start + 1

Edit: censor package name

I noticed I had node 15+ installed and was getting a warning saying that this version of node wasn’t 100% tested. So I downgraded to the supported version to check if it would help, but no success.

Edit: Typo

it’s a JS exception, so could you try running this in production mode locally with expo start --no-dev --minify?

1 Like

It also crashes. On the terminal, I get this error:
Unable to start your application. Please refer to https://expo.fyi/no-registered-application for more information.

And this is the error info on the simulator:

TypeError: undefined is not an object (evaluating 'x.Native.init')

<unknown>
    AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:746:554
v
    AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:2:1473
<unknown>
    AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:6:60
v
    AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:2:1473
d
    AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:2:875
global code
    AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:1586:3

that’s a great thing to look for! where are you calling Native.init in your code? or which of your dependencies are doing it?

1 Like

That was it! The issue was in a Sentry.init() call.
I kept looking for Native.init and couldn’t find it, until I saw your answer and it made me think: Here’s how I was importing Sentry: import {Native as Sentry } from 'sentry-expo';

So now I’ll try to figure out what’s wrong with this call.

Thanks for the help! :clap:

the correct import style for expo-sentry is the following:

import * as Sentry from 'sentry-expo';

Sentry.init({
  dsn: 'YOUR DSN HERE',
  enableInExpoDevelopment: true,
  debug: true, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
});
1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.