React Native opens to white screen in Android simulator - android

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.

Related

Expo & Metro Bundler crash when attempting to open on Android Emulator

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

Could not connect to development server - react native error

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.

the development server returned 403 react native

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

Is Android Studio supposed to start Metro Bundler when running a React Native app?

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

Loading react native issue on emulator GenyMotion

I am using react native
react-native-cli: 2.0.1
react-native: 0.55.3
I was running via
react-native run-android
The screen is always loading the app (Debugger Mode)
NOTE: It was sudden issue, it was working fine till yesterday.
*PC is Restarted several time and also JS server using kill -9 PID
I've met this error before when I started to programming React Native on Ubuntu.
The reason why you got this error because your Genymotion didn't have same port with local machine.
So here is the solution:
Open the Developer Menu of mobile app on Genymotion
Choose the Debug Server port & port for device
Set the value localhost:8081
reload the app and enable the Debug. Now you can debug the app.
Cheer!
Maybe it is a problem with the app already installed in your phone.
Try running :
adb uninstall com.yourproject
This will install all of your project packages for all users on your emulator/phone
Temporary fix:
REACT_TERMINAL=<your terminal> react-native run-android
in my case with manjaro + xfce4:
REACT_TERMINAL=xfce4-terminal react-native run-android
or puts in your .bashrc:
export REACT_TERMINAL=xfce4-terminal

Categories

Resources