jeanpaul62
jeanpaul62

Reputation: 10551

React Native App crashes on Launch Screen on device

I'm starting with React Native, everything works fine in the iOS simulator. I decide to try it on a device.

The app launches, I can play with it, I close/reopen it around 4 or 5 times, and then somewhat randomly the app crashes on Launch Screen (the one with "Powered By React Native"). It just shows the screen, and the app crashes to the iPhone home screen.

Any idea how I can further debug that?

Edit: I added Bugsnag in my AppDelegate.m, but bugsnag doesn't detect anything when the app crashes.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  [BugsnagReactNative start];

  // Rest of code  

}

Upvotes: 18

Views: 44957

Answers (8)

dev1ce
dev1ce

Reputation: 1717

In my case it was the Firebase GoogleService-info.plist file which was missing that is supposed to be present in your project.xcodewrkspc when opened using XCode. Adding that resolved the issue.

Upvotes: 0

Tahir Smasher
Tahir Smasher

Reputation: 11

I finally solve this error by running the app in release mode from xcode

  1. goto Product->Scheme and then click edit Scheme
  2. Select run from left side menu
  3. change Debug to Release
  4. untick Debug executable
  5. now clean the project and run your app in release mode
  6. Some time you have to delete pods and install again after doing above
  7. look for your error in xcode console in my case VS code has imported a Library I just have to remove that import

Upvotes: 1

Dipanshu Chaubey
Dipanshu Chaubey

Reputation: 890

I had a similar issue. My application crashed on emulator device every time I ran the application without throwing any error in the console.

Here are a bunch of solutions that might work:

Solution 1 Remove node_modules

rm -rf /node_modules
npm install

Solution 2 Remove /android/app/build directory (This one worked for me)

rm -rf /android/app/build

After this, uninstall the application from emulator device and then run your application again

Upvotes: 3

Rakesh
Rakesh

Reputation: 552

I was also facing the same issue on real device and it was working fine on simulator. So, i have fixed my issue by given solution

Solution: i have uninstall the application from simulator and then installed it again. This time it showed me the actual error on simulator that i had made mistake.

Upvotes: 1

shehanrg
shehanrg

Reputation: 606

This can caused by many issues it seems. Recently this happened to me and I had to search a bit to find out the exact reason. I'll save you guys the trouble by sharing few places I read - https://github.com/facebook/react-native/issues/14500#issuecomment-348063910 - https://github.com/facebook/react-native/issues/17276#issuecomment-357538208

In my case it was a library issue which I have not linked properly.

-https://github.com/ivpusic/react-native-image-crop-picker/issues/204

So yeah! my point is, it's something we have done or not done. Bit more research would help!!!

Upvotes: 5

Sujit
Sujit

Reputation: 658

For me lottie package was creating problem. After removing the package able to launch the package.

Make sure by checking the last package/packages installed

Upvotes: 0

user602525
user602525

Reputation: 3254

I had this problem also, what triggered it for me though was updating react and react-native.

I did a build after updating and then I experienced the same issue. I downgraded back to the previous versions of react and react-native, but that didn't work for me.

I tried removing node modules, and reinstalling, that didn't help. Then I noticed that when I was building: react-native run-ios,

the files in ios/build were not updating

I rm -rf ios/build/ and then I react-native run-ios and the ios/build folder populated. My app ran fine after that.

Upvotes: 0

Zolve
Zolve

Reputation: 524

I came across this issue today. Read a few SO posts and saw one guy mentioned if your app launches and hangs on the splash screen and then crashes with no error it probably has something to one of your npm dependencies.

After digging deeper i saw the react packager was throwing the error

This error is caused by a @providesModule declaration with the same name across two different files.

To fix

  1. check / clean up dependencies(check for same name declerations)

  2. rm -rf node_modules

  3. rm -rf $TMPDIR/react-*

  4. npm i

Upvotes: 8

Related Questions