React Native app builds multiple times rapidly then fails when in production mode in Expo - react-native

Despite the app running perfectly in test builds, when I publish the app or put in in production mode the app builds once that takes a while, then several times within short succession as seen below:
After it stops I then receive the errors:
"Module AppRegistry is not a registered callable module (calling
runApplication)"
and
"undefined is not a function (evaluating
'babelHelpers.objectDestructuringEmpty(d.actions)')"
I have looked up this issue and found that those 2 error messages tend to be vague "catch-all" errors, however none of the posts I found had the rapid build issue I have, so that may a key part to solving this. I have tried restarting the app several times, npm install-ing, updating react and expo to their latest versions, and other small non-code related fixes however none have worked.
Here is a link to my repo: https://github.com/tc1240/AT-Assist. If anyone has had this or can take a look at my code any help is appreciated. Thank you,
Also this is my first question asked on stack so I apologize in advance if my question does not follow some of the guidelines.

I've been experiencing this lately, since I tried publishing for Android and iOS.
I'm currently unable to build additional projects in Expo other than the one I'm working on, so I can't test your project, but:
Can you add the android.package key in your app.json file and try running again? Restoring this back into my project seemed to fix the issue for me.

Related

Expo React Native building apk

I have been trying to build my apk today but I always face this problem. After completing the build, i download it to my phone and i cannot open it. However, this was not the case 2-3 days ago. I had no difficulties or errors in Run expo doctor. I was able to download the apk to my device and test my app.
I am not really sure what to do and any help would be appreciated.
This is what I got after running npx expo doctor:
I managed to solve my problem. I used Android Studio's logcat feature and when I ran the app on the emulator I found the issue - it was related to admob. At this point, I dont need admob, so I deleted its folder from my project and everything was fine after this.
Running expo doctor usually ends up in flagging what dependency needs to be upgraded if the jump to automatically update it goes into the majors like in your case from 4 to 5.
Maybe try upgrading #expo/config-plugins by using expo upgrade or commands from your preferred package manager.
If that’s impossible due to other packages depending on the specific version, maybe consider adding overrides in your package.json. Here is a helpful article about that.
In my experience this may not be the only reason for the crash of the app. Try running the app consecutively about 3 or 4 times even if it crashes and I believe Android will prompt you to submit a bug report and maybe show you the call stack it failed at.
Let us know how it goes.

React-Native Android Build - Could not determine artifacts for com.facebook.soloader:soloader:0.8.2:

This is a brand new issue. I reviewed the code, and no changes have been made to the libraries in 3 months. All of a sudden I am getting the error "Could not determine artifacts for com.facebook.soloader:soloader:0.8.2:" I tried updating this to 0.9.0+ based on React Native: App crashes on start due to SoLoader issue, but then I just got a bunch of "xxxx library uses a deprecated API". I have cleaned the project multiple times, invalidated caches, restarted computer, etc. but I can't find anything about how to fix this problem, nor do I know why it started happening. Does anyone have any insight?

React Native background location (#mauron85/react-native-background-geolocation) - problem installing, how to link modules with Expo managed workflow?

I'm developing a sports app with React Native / Expo which needs to track user background when the app is in the background.
This is related to my previous question (React Native expo-location: How to make the background location service update more often?). I came to the conclusion that the background location tracking in the 'expo-location' package does not seem to sufficiently work, so I started building a new solution based on the package '#mauron85/react-native-background-geolocation' (https://github.com/mauron85/react-native-background-geolocation) which I found was recommended in several tutorials.
So I installed the module and built my map component based on the example code provided in the documentation (https://github.com/mauron85/react-native-background-geolocation#quick-example).
However, when running the app on Expo Go, I get the following error message despite doing all the required imports:
Component Exception: RNBackgroundGeolocation is undefined
This appears to be caused by a problem in linking modules, which I failed to do during the installation. The component requires to do linking of modules with the following command:
node ./node_modules/#mauron85/react-native-background-geolocation/scripts/postlink.js
Because I use Expo managed workflow, I lack the folder structure (./android/settings.gradle etc) required by this script and receive an error of 'android/settings.gradle not found'. Based on some searching, this seems to require running 'expo eject' on the whole project so that I can do configurations in the platform-specific folders.
However, 'expo eject' runs into errors in the "Installing JavaScript dependencies" phase and just returns an error of "Something went wrong ... ...", and the error logs provide no further clarification.
Questions:
How to get forward when something goes wrong in the 'expo eject' phase like this? The error logs get really messy and unclear.
I would really prefer to stay in the managed workflow to avoid any mess. Is there a way to get the modules linking work within the Expo managed workflow?
Any help appreciated, thanks.

React native app sourcemaps show incorrect location of error when error happens in asynchronous code

I have a react-native app. I recently moved to react-native version 0.61.5 for which I took the long route of creating a new react-native app and porting my code over to avoid any linking issues since new version used PODFILE as the default linking mechanism. Ever since I moved to version 0.61.5, I don't get the correct location of code in error logs. I think this is mainly happening when the code is running in asynchronous fashion which most of the code is. For e.g., look at below screenshot:
It is reporting that it is not able to call map on some array which is apparently undefined but the place where the error is reported is completely incorrect. I have no such file in my codebase and it is probably pointing to some file in some react-native package.
I am using Sentry #sentry/react-native": "^1.1.0". I don't think Sentry can cause issue with the sourcemaps reported during development.
I am not sure how to debug this problem. This problem is causing a lot of issues in debugging any errors as I have to manually figure out where the error happened. Please let me know if you have any tips on how to fix this problem.

React Native Example App does not run in Expo Snack

I'm learning React Native and trying to add a component to an Expo Snack for testing. I can't even get the example app to work though.
Is it something different about how Snacks work vs. a desktop development environment? I've encountered that type of difference using JSFiddle, for example.
I straight copy-pasted the code from the Github repo into snack.expo.io and it gave me an error:
Device: (946:881) Unable to resolve module 'module://expo-font.js'
Evaluating module://expo-font.js
Evaluating module://react-native-numeric-input.js
Evaluating module://App.js
Loading module://App.js
I've gotten this error before, but I've never been able to figure out why. Is it an issue with the package, which was updated just 7 days ago, or something else? Please advise.
It may be due to missing of node modules in your project compared to the Github project. As the Stack.expo browser won't give us full freedom to install custom modules, I suggest you to download VS Code and open the Github project in it, then do "npm install" from cmd and "react-native run-android/ios".