React Native App crashes if signed and released. Works fine in debug mode - react-native

React Native App crashes if signed and released. Works fine in debug mode. It doesn't throw any error in the screen. It simply crashes. When I looked at cat log. no error.
I also tried build apk with --info, but no additional info while crashing. I also tried building APK by setting minifyEnabled false.
When run the app in debug mode by connecting my phone via USB, it works.
I'm tried creating apk with --debug but I'm unable to install it my phone, it says parsing error when I try to install using app installer.
I got the following logcat errors. What does it mean?
09-03 11:03:07.968 W/ActivityManager(1344): Force finishing activity com.myapp/.MainActivity
09-03 11:03:08.012 W/BroadcastQueue(1344): Skipping deliver [background] BroadcastRecord{cb72147 u-1 android.net.conn.CONNECTIVITY_CHANGE} to ReceiverList{7bf2161 22421 com.myapp/10100/u0 remote:b9cdcc8}: process crashing
09-03 11:03:08.035 W/ActivityManager(1344): Dismiss app error dialog : com.myapp
09-03 11:03:13.095 I/WindowState(1344): WIN DEATH: Window{3f22c22 u0 /com.myapp.MainActivity}

I finally found the cause. There is module called react-native-material-design-searchbar which was causing the issue. The weird part is, if directly copy the SearchBar.js from that module and use it all works fine even in release, but if use module as direct import it's not working only in release mode. So weird. The SearchBar is good, so now I'm using directly by copying the file to my project.

I fixed this error by uninstalling uglifyjs and reinstalled the latest (using NPM).

Related

Blank screen when building React Native app in release mode of android

I am building a React Native app and it works fine in debug mode, but when I try to build it in release mode, it shows a blank screen. I have tried several things to troubleshoot the issue, such as updating my dependencies and checking for any syntax errors, but I haven't been able to find the cause of the problem. I am not seeing any error messages, and the app seems to be working as expected in debug mode.
I am not sure what is causing the issue in release mode, and I would appreciate any help or suggestions.
Here is what I have tried so far:
I have checked that my React Native dependencies are up-to-date and correctly configured.
I have ensured that the bundle is being correctly packaged in the binary APK.
I have verified that there are no syntax errors in my code.
Use this error handler https://github.com/a7ul/react-native-exception-handler to catch problems in production. It supports both JS and Native side errors

Understanding "Application has not been registered" error

I've been given a new React Native app to maintain and whenever I build it or run it in the simulator, I get the "Application has not been registered" error. There are no other errors in the console before this message (although there are some warnings). I can't find any code issues as if the error message is dismissed in the simulator, the app runs fine so the bundler is running correctly, although on an actual device, this registers as a crash on open.
I'm running in the simulator using react-native run-ios from the project root. Builds for running on actual devices is managed by Fastlane.
My app doesn't make an explicit call AppRegistry.registerComponent due (I think) to the way react-native-navigation is set up, so most of the info online about this error doesn't apply.
Where should I go next to figure this out?

React Native Release Signed APK crash on app start time

I have an issue with react native release APK.
The app run on debug mode but it crash immediately on release mode
Is that app running without any warnings/errors before building the APK?
The error message clearly says that it can't find a variable, maybe it got deleted or modified.
You can cross-check the app once by going to the development mode and see if you get the same error.
Try out clean your gradle and make the apk again.

react-native create app hangs while create

I use react-native with actual version and have tried to create a simple project. But while trying to create it by using
expo init AwesomeProject
the whole process hangs.
I have tried to look for a solution by searching on the internet but without any luck.
The error could be seen in the following screenshot:
That error generally means that a file is being accessed by two different things at 'around' the same time. And 90% of those times it is because of an anti-virus or similar.
Its a permission error, so my advice, try to do it after a fresh reboot and boot the powershell as admin, disable antivirus etc..
If still does not work reinstall nodejs/npm.
I had the same experience. The project gets created using React-native. When you try to run it, the 'Metro' interface comes up. There is an android phone on the USB drive which has previously been used to run Android Studio created projects successfully. However, on the command shell the app hangs in Metro.
While trying to run the project from Android Studio snow cat, there are build errors (red) in the App manifest file and there is this exception.
Build failed due to java.lang.NullPointerException
Installed expo-cli (C:\Reactive-native>npm install -g expo-cli). The app fails to run and hangs on the connected Android phone(Samsung 21) using the Expo Go client. This client has no problem having been tested in Snackbar.
I have a question in the Expo forum and probably someone will answer!

Unable to find module for EventDispatcher React Native

On starting application using react-native run-ios its showing error on simulator Unable to find module for EventDispatcher
Stop remote JS debugging and then reload the app
It will give you the appropriate error message, most likely missing some render on one of your components. That fixed it for me.
So this issue happened to me after I upgraded to RN 0.59.x.
I was getting this error when live reload was enabled or if i tried to refresh screen on iOS by pressing CMD+R.
Related issues:
Unable to find module for UIManager
Unable to find module for
DevLoadingView
Unable to find module for EventDispatcher
Here's how I solved it:
Edit your AppDelegate.m file and add the following code before the #end
#if RCT_DEV
- (BOOL)bridge:(RCTBridge *)bridge didNotFindModule:(NSString *)moduleName {
return YES;
}
#endif
This will fix the issue.
Link to the fix on github.
Related discussion on github.
Live reload and debug mode all should work without problems now.
This seems to be an issue when using the remote debugger with certain RN versions above 0.58. Using react-native-debugger should solve the issue as it supports RN versions above already.
It can be downloaded from the following link:
https://github.com/jhen0409/react-native-debugger/releases
I've started receiving this error after upgrading RN from v0.57.3 to v0.58.6.
Running packager with yarn start -reset-cache / react-native start --reset-cache fixed the issue for me.
What worked for me was simply stopping remote debugging as mentioned by #Hackman,
THEN killing the browser debugger, cleaning Xcode and rebuilding.
Couldn't tell you why, but the issue went away.
I'm using detox, what worked for me was switching the build command from
-configuration Debug
to
-configuration Release
It will no longer fetch from metro bundler and instead use the js bundle from the build. When I'm coding the tests, I build with debug since I'm fine with occasionally seeing the error, since I like the connivence of not having to constantly build and letting metro bundler do it for me.