0

I have an Expo React-Native app that works fine on the simulator but crashes immediately when on a device in release mode. I don't see anything in the crashes and ANR errors section of my app. What can I do to debug this issue?

What I use to test on the simulator

npx react-native run-android --variant=release

What I use to build the release

./gradlew bundleRelease
James Anderbard
  • 374
  • 2
  • 6
  • 20
  • 4
    Install it on a device and run it after enabling [usb debugging](https://developer.android.com/studio/debug/dev-options) and check the crash traces in [logcat](https://developer.android.com/studio/command-line/logcat) – Muhannad Fakhouri Dec 26 '21 at 10:17
  • Or you could install flipper https://fbflipper.com/ and check the crash log from flipper – Jacky Wijaya Dec 27 '21 at 15:39
  • dear @JamesAnderbard, please add more information – AmerllicA Dec 29 '21 at 14:07
  • I installed it on my phone and connected via usb debugging and found an error in the logcat: now working through the remaining errors – James Anderbard Dec 31 '21 at 01:10
  • Currently getting the following error and not sure how to solve for it: https://stackoverflow.com/questions/70539379/react-native-error-project-with-path-expo-modules-core-could-not-be-found-in/70540742#70540742 – James Anderbard Jan 01 '22 at 06:11
  • Please include the error printed on crash.. – Pierre Janineh Jan 01 '22 at 14:47

2 Answers2

0

here there are some tips to you :

1- Currently react-native-gesture-handler has to be imported before everything for the release build to work without crashing.

Add this line at the very top of index.js:

import 'react-native-gesture-handler';

Then try to clean and rebuild the release again.

2- AppRegistry.registerComponent('App', App); when it actually should have been like this

AppRegistry.registerComponent('App', () => App);

3- You should put --minify=false in extraPackagerArgs in android/app/build.gradle

as some of the classes/functions/methods might be ignored and not included in the release build if the compiler thinks its not used. In your case, the compiler might not have included expo.modules.updates.UpdatesController or the whole expo library.

project.ext.react = [
    entryFile: "index.js",
    extraPackagerArgs: [ '--minify=false' ],
];

4- it can be caused duplicate assets or android bundle , follow this instruction

5- if none of the steps works , try to debug with Flipper , follow the instruction from here

Amir Doreh
  • 1,369
  • 1
  • 13
  • 25
0

I had once a similar situation. I used a library to create uuid's and that lib used nodeJs crypto that was not available on every android device.

Simon Hansen
  • 622
  • 8
  • 15