After an attempt to use the adb tool to pull an updated sqlite database to my android emulator, I am unable to run my app on that emulator. Instead of showing the main screen of my app, I get the "Welcome to React Native!" demo app. My source code does NOT contain this; all my App.js contains is a definition for a StackNavigator.
Here are the things I have tried in order to fix this:
Via the AVD console in Android Studio, delete and recreate the image (Nexus 5, Android 6 with Google API)
Via the same console, use the Wipe Data option to try to reset it to a blank state.
Various npm commands, such as clean cache.
In addition, when I attempt to run react-native run-android from the command line, it usually immediately exits after building the application.
Can anyone give me any idea what I can do just to simply run my app on the emulator?
App source is at https://github.com/fergusonjason/soccerstats if that is any help.
(Yes, I realize this sounds stupid. Why it would replace an app I've been working on for 3 weeks with the react-native starter app is beyond me).
Jason
Assuming your java script bundler is up and running with react-native start you can try to reload by running adb shell input keyevent KEYCODE_MENU in another terminal and pressing reload after the Dev Menu shows up in the emulator.
Then be sure to check in your terminal where you ran the start command, if the Bundling log shows up. If it doesn't shows up, then perhaps you have another bundler running, which needs to be terminated before you can run your project
After trying several things, I ended up forcing a rebuild of index.android.bundle:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
It's possible that I had never staged or committed any updates of this file to the github repo.
Thank you to Aureo Beck for attempting to help me.
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 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
thanks in advance your your help; I rather a newbie with RN and Android (i used create-native init to create project).
Issue 1: when i first ctrl+M and choose "Debug JS Remotely" it attempts [http://10.0.2.2:8081/debugger-ui] but hangs indefinitely.
Issue 2. and when I finally give up and instead manually visit [http://localhost:8081/debugger-ui/], I have no way to revert AVD from "white screen of death"..ive tried "Stop Remote JS Bebugging", "Reload" etc....but end of having to use "react-native run-android" to refresh
Issue 3: Once I finally have [http://localhost:8081/debugger-ui/] displaying the desired "Debugger session #0 active" and I go into dev tools --> Sources --> Network --> debuggerWorker.js.....I don't see my folders/files listed. See screenshot.
RN is hard enough without being able to debug!
This solution worked for me:
ctrl+m on your emulator.
click on Dev Settings.
Disable User JS Delta
restart the react native server. (ctrl+c in the terminal and then npm run android)
This is an issue with the of latest version of react-native (0.54).
After some investigation, I found there are two ways to workaround this issue.
Option 1. Downgrade react versions, modify the package.json of your AwesomeProject as below
"dependencies": {
"react": "16.2.0",
"react-native": "0.52.2"
},
Then run these commands:
cd AwesomeProject
rm -rf node_modules android
npm install # this will bring folder node_modules back, with react/react-native of previous version
react-native eject # this will bring folder android back
react-native run-android
Option 2. Turning off Use JS Deltas as mentioned in this issue
But the author did not provide full steps, which led me working out option 1.
Cmd+m in your emulator, and turn off "Use JS Deltas".
Find the termnial window for "Metro Bundler", press Ctrl+c to terminate it, then press the Up arrow to re-run the command for "Metro Bundler", such as /works/StackOverflow/node_modules/react-native/scripts/launchPackager.command ; exit;. (This is an important step).
Now back to Chrome, you can find your source files listed under debuggerWorker.js > localhost:8081.
I was having the same issue , manage to fix it by going setting inside inspect element and enable the javascript
I have some issues with React Packager on Windows
Loading
After loading (long long wait), my application is lauching well on AVD Android. But when i change a file and i reload on my app, i see no change. I can do that 10X and no change. (I'm talking about the welcom react base app and i change index.android.js file so nothing very exotic)
Some times, the change on *.js file are detected and my app update well. When it work, it work all the time until i stop the packager. When it doesn't work, it doesn't working until i restart packager.
So for too work, i have to launch, try, launch, try, launch try until it is ok. As you can see, the loading can take 3min so it's not cool.
I tried to activate, desactivate hot reload but no change.
I don't think it's a network issue because after reboot packager, sometimes i have the old version. So i use --clear-cache option. And when i reload the app in android, i can see that packager catch the request but don't send the good version.
So i've conclued that Packager didn't detect very well the file change.
I know on Windows Watchman does not existe maybe there is a work around !!! If you have a solution for slow loading i'm ok too :-)
Can you help me ?
npm -v react-native : 2.15.1
npm -v : 2.15.1
node -v : v4.4.4
Thank you !!!
I had the same problem with nodejs 4. But when I installed nodejs 6 and make run-android init again the problem is fixed. Try to uninstall node 4 and install node 6.
After deleting .expo and node_modules folders and running yarn install changes detection started working again