Unable to run react-native release build - react-native

I am trying to deploy my react-native app to android. I follow the steps on this page
https://facebook.github.io/react-native/docs/signed-apk-android.html.
When I try to run it, it tells me
not such file or directory '.../assets/index.android.bundle'
or I get
Task 'installReleaseDebug' not found in root project 'awezaEduApp'
Using Windows 10 and react-native 0.39.2
OUTCOME
I ended up having to reformat my laptop for other reasons and when i repeated the signing process it worked. On account of my previous efforts, prior to reformatting, I would presume that Eldelshell's answer would have solved it.
Note: I think that running gradle tasks in Android Studio's terminal would also work.

You need to execute react-native run-android at least once. Don't worry if it fails because you don't have the emulator running.
or I get Task 'installReleaseDebug' not found in root project 'awezaEduApp'
You have to execute gradle inside the android folder.

Task 'installReleaseDebug' not found in root project 'awezaEduApp'
For RN 0.39.x, you have to run the following for release build:
react-native run-android --configuration=release

Related

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!

React native error install failed already exists

I just started working with react native. I created a new project using
react-native init ChatSample.
Then i run this command
react-native run-android --deviceId MYDEVICEID
Now after finishing 100% it shows this error
adb: failed to install app/build/outputs/apk/app-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install com.chatsample without first uninstalling.]
I moved to this folder and found that app-debug.apk exists there so i deleted it, but again when i run this command it shows same error.
Then i deleted the complete build folder and run this command but still got the same error. More precisely when it is around 50% it starts creating build folder and app-debug.apk and as soon as it reaches 100% app-debug.apk file is created in that folder. But why is the error coming, like this is a fresh project and all i did is just run two command first for creating project and other for running app.
You can open the project in Android Studio from the ProjectFile/android. Then build and run on your Phone
Is in your device the APK installed? Try uninstalling the APK from the device and then run the command again.

Integrate viro-react into react-native project

Anyone here managed to integrate viro-react into react-native project? I followed the instruction in
the documentation
After that, I executed the project but not able to run.
This is the error that I got
Even though I run with gradlew installOvrDebug, still it failed.
If your configurations are correct then try running with any of these variants
ArDebug, GvrDebug or OvrDebug
Example running apllication with Augmented Reality:
Android
react-native run-android --variant=ArDebug
iOS
react-native run-ios --variant=ArDebug
I solved this problem with the following method:
Go to the Navigate to the node_modules/react-native/local-cli/runAndroid/runAndroid.js file and edit the lines that include installDebug change it to installArDebug
Go to the terminal and npm start
Open another terminal and react-native run-android
*Make sure that your device is plugged in and that you have android studio sdk paths in your environment variables. This should do the trick!

React Native app crashes without any error log

React Native app crashing without any error log. No output on "react-native log-android" terminal, no red screen with error, Android emulator just crashes. Tried running with Expo, again crashes with no error
Happens when working with TextInput. I have some ideas how I can fix the code, but want to understand why is app crashing without error log and making debugging much more difficult?
my bug was fixed by deleting the build folder(inside android/app) and running
npx react-native run-android
Run adb logcat
You can find your app name in your package.json, under the name field.
Also when looking for errors specifically dealing with react native, try running
adb logcat | grep 'redbox'
This way you don't have to scan the entire logfile.
Or try the method shown in this article:
Run adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your Android app's logs.
I was running an Android Project on my Linux PC, then I have made some changes on it in a MacOS PC, and when I git pulled de project back to Linux I faced that crashes
inside the android folder, just run:
./gradlew clean
and then try to run it again.
In case none of these work, don't hesitate to just filter on Warning or Higher as sometimes there will be a low level error that will not be caught by the RN filters.
I was only able to find my issue(s) with the following:
adb logcat '*:W'.
In case react native app crashes without an error message checking the problem in Android Studio's Logcat works perfect. But don't forget to create a filter with your package name.
Open Android Studio
Open Logcat
Click on "Edit Filter Configuration" in the right top of the logcat screen
Fill in your criteria (don't forget package name)
Run you react native project on an android device or emulator
This may be because SOLoader is absent.
Ensure
implementation'com.facebook.soloader:soloader:0.9.0+'
is added under dependencies in android/app/build.gradlle
clean your build
cd android
./gradlew clean
Try bundling
./gradlew bundleRelease
Exit android folder
cd ../
Try running
npx react-native run-android --variant=release
My app kept crashing because I had changed the name of the app in a few places. Make sure your app name is the same everywhere.
Check if the folder name in
android/app/src/main/java/com/<appname>
has the same name as that of your app in manifest file in
android/app/src/main/
My RN App works correctly before, suddenly one day it does not work, keeps crashing without error log. All I have to do is: delete build and .gradle folder under android folder, then run again, it works. Hope it may help someone.
this worked for me
run react-native start --reset-cache
after this if app throws some import error kill the task and run react-native start or npm start normally and open the app.
Deleting my node_modules, reinstalling them and run
npx react-native run-android
fixed it for me
While running your Android Emulator for debugging also run
Android Studio -> Tools -> Android -> Android Device Monitor
It will tell you exactly what is crashing the app under LogCat tab.
two easy steps solved my problem...
open android studio and remove offline bundle from src/main/assest..(** if any)
open MainApplication.java and remove the following import..
import com.facebook.react.BuildConfig
I had the same issue, maybe you made the same mistakes i did.
Make sure u didn't change the app's package name (ex: com.myapp.app).
I lost a lot of time on this. Seems like someone else published a app with the same name on google play, and i didnt change it correctly in each place i should on mine.
Anyway, if that is not your problem, it is probably in something u changed in build.gradle or other config file, try to remember where u last changed something.
Was having this issue on Windows 10
What fixed it for me in the end was:
delete C:\Users\%userprofile%\.gradle\caches
deleteyour-react-app/android folder completely - then 'Discard Changes' in git so you get the original files back
re-run npx react-native start and npx react-native run-android
A tip, my emulator api version was 32. And my targetSdkVersion was 31.
I created another emulator which api level is 31 and the error is gone.
Well first of all, does it crashes when it opens or does it crash at a specific screen? Mine crashed because I did not put my text inside <Text></Text> inside the TouchableOpacity
a very simple solution for me.
delete this file -> gradle-wrapper.properties
and run android folder with android studio.
In case you tried any of the given suggestions and none worked, use Android Studio to run the app in debug mode and then watch logs at the debug console.
For me, it was a styling rule error. I did
paddingTop: Platform.OS === 'ios' && 50 which caused the app to exit immediately on Android.
The debug console log I got was E/unknown:ViewManager: Error while updating prop paddingTop
To correct that, I did paddingTop: Platform.OS === 'ios' ? 150 : 0
Delete Your node modules
Then run npm install
after this run
for window
gradlew clean
for macOS
./gradlew clean
then run
npx react-natie run-android --variant-release
or
npx react-natie run-android

React Native FCM not working

I am using this package https://github.com/evollu/react-native-fcm
I complete the installation process. The project is working. But every time I turn it on project. I am working ./gradlew clean on console. Other than that, I get the following error when I run
You can delete build folder, and recompile project again.