I had a react native project that is working fine and I switched to another project which is also a react native project. When I came back to the development of the first project I ran the following commands. I use a physical device to debug.
cd ./projectfolder
react-native start --reset-cache
react-native run-android in another terminal
Now the following problems are there, I would like to know what are the causes.
react-native start starts the Metro Bundler but it does not show the
loading progress of the files after react-native run-android
finishes. (Does not serve files)
Still the application starts without any red screen. (How does this
happen if the Metro Bundler has no progress shown?)
Since the application starts I can shake the running device and try
to enable the hot loading but it gives a error on the red screen.
(Sorry for the bad quality, I got this from internet. The same message is there on my physical device.)
I have tried the following methods.
Clear the npm cache using npm cache clean --force.
Make sure that the laptop and the mobile are on the same wifi.
Add android:usesCleartextTraffic="true" to the manifest since there are Android 9 related changes as per most github answers.
Uninstall the application and trying to run again.
Restarting everything.
Ran the bundle command and try but it will not help start the debugger.
Can I have any help on this? Thanks in advance.
Related
On a react-native project, since a few hours, I have a huge issue : Expo doesn't want to open my App on my android emulator.
I'm doing : expo start in the terminal,
I have the terminal interface with the QR Code
And when I press a to open on android, in my terminal I can see Opening on Android... and nothing happens
So I've tried to use the Metro Bundler graphic interface in the web browser to open my app and when I click on the button Run on Android device/emulator, I can see the message Attempting to open a simulator and nothing happens.
I've restarted my computer many times, I've tried npm run --clear-cache, expo r -c and still, nothing happen when I want to open my App on my emulator.
4 hours of trying to solve this and I found no solutions...
EDIT : I can use my Application on my iPhone using the Tunnel connexion
EDIT : When I try to open the Application on an android emulator, expo crashes. I can't even close it with CTRL+C on the terminal
I created a new default project with React Native 0.60.4 and it opens ok in the iOS simulator, but when trying to open it on Android by selecting the project directory and then npm start, react-native run-android it opens to a white screen.
Then shortly after it returns an error message in the android emulator saying:
Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle is packaged correctly for release.
The Android simulator is working fine with Flutter so there should be no problem. I looked at other solutions for this issue and they say run react-native start first but I most certainly have done.
First run adb reverse tcp:8081 tcp:8081 on your terminal
You can find it in ~/Library/Android/sdk/platform_tools/
If that's not working please check your host ip and port on developer menu on android.
It can cause the issue on your side.
I am doing a react-native based android app following the geeting started tutorials hereusing real android device connected using USB.
When I run react-native run-android it is resulting in error that says development server returned 403 react native
I tried looking it up online but all I could find was that Mcafee blocks the pory 8081, but if that is so how do I change it and make it work.The pictures attached shows what happens when i run"react-native run-android" another picture is here.
Any suggestion would help a lot!Thank you!
This smae question was asked earlier too here
Have you tried to execute react-native start in the same directory where you use react-native run-android?
Try to close all your opened node terminals and:
1) run react-native start
2) wait until node would open the terminal
3) run react-native run-android
Supposedly the two ways you can start a react native android app are:
react-native run-android via command line
OR
Open your project in android studio and press Run.
The issues I am experiencing are that using option 1, i will get an error that no devices are available:
com.android.builder.testing.api.DeviceException: No connected devices!
and using option 2 results in an emulator starting and the installation of the app successfully, but the JS packager doesnt start as part of this flow.
Now sure, I can easily get around this by either
Run the packager manually before starting the app in Studio
Starting an emulator before running react-native run-android
but it seems like this is indicative of a problem somewhere
I have checked out this similar question here React Native: Android Studio doesn't automatically bundle when building but that is unrelated to whats happening to me
When I run react-native run-android I get the bellow Error:
BUILD FAILED
Total time: 19.668 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
But after running it for several times and having error, let say about five times, it works!
this process wastes so much of my time, so any suggestion is appreciated.
Install the app manually with adb in your emulator if not installed, then you could just use react-native start to start react native.
This problem occurred to me too.
If you don't have expo app installed on the emulator then download expo app and install it on your emulator, if you don't know how then see this post.
If you have it installed then clear the node cache as mentioned upwards and do npm start don't do npm start android, If don't work again then u reinstall all the packages but u must delete all the packages that are located on C:\Users\YOURUSERNAME\AppData\Roaming\npm and C:\Users\YOURUSERNAME\AppData\Roaming\npm-cache delete all those and then go here and create a new project from scratch, that worked for me.
And if you have expo software application on your computer don't use it ,it mess up your project with updates and so new problems come, just use the terminal.
Goodluck.
What helped me was to occasionally open and build the project using android studio. It will download all the gradle updates and android versions... most of the time I start the emulator from Android studio and the npm start to start the packager.