I receive these error although I followed exactly react native guidance, I launch the emulator manually then I run these command (react-native run-android) although run-ios works perfectly
Related
OS: Linux Ubuntu
CLI or Expo: CLI
RN Version: 0.70.6
I start my React Native project with the following commands:
yarn start
yarn react-native run-android
It works when a real device connected to my PC and the project starts on my device. But it does not work with an Android Emulator.
When I try with an emulator:
yarn start command shows usual outputs. No error, nothing. Seems to work correctly
yarn react-native run-android also same. Build successful. No error or warning.
adb devices command shows my emulator correctly.
But emulator does not start my project. I can see my project icon on the emulator. When I double click to my project, I just see a blank screen for one second or less and it closed again.
When i try to reload metro using r command on terminal it says no apps connected.
I think the emulator builds the app but not connect to metro properly. I don't know why. I cannot see any error or warning messages.
I tried ./gradlew clean and delete node_modules and install but it didn't work.
I also tried yarn start --port 8081 but it also didn't work.
EDIT: For testing purpose, I created a new project with `npx react-native init AwesomeProject' and it works on the emulator. So I think the problem is only about the other project.
SOLUTION:
In my case it was because of Flipper version. When I changed it from 0.125 to 0.144 my project started on an android emulator properly.
Here is the link where i found the solution:
react-native-issue-in-github
I ejected an expo project and tried running npm start and npx react-native run-android. The bundler runs and shows this
To reload the app press "r"
To open developer menu press "d"
The app is installed in the emulator, but shows the following error.
unable to load script. make sure you're either running a metro
server (run 'react-native start') or that your bundle
'index.android.bundle' is packaged correctly for release.
The emulator is able to reach the host machine IP address in the browser.
I tried the following solutions.
Run npm start or react-native start in the root directory of your project before react-native run-android
android:usesCleartextTraffic="true"
Changing port
Nothing helped me. What could be the issue?
Picture of hang in terminal
Just getting started with react native. I've gone through the instructions React-Native and have set up my android emulator, got all that stuff good to go.
I used npx react-native init auth to start a project where I hook up some authentication in RN.
Everything was going well until I ran the command react-native run-android and now it just keeps hanging when it gets to "Starting JS server..." and doesn't do anything.
Compile a react-native Android app without using packager:
react-native run-android --no-packager
After, start packager in another terminal session to bundle js:
react-native start
open a new tab in terminal and execute this command
react-native start
it should be starting the js server
enter image description here]1
I am doing following step to start react application
react-native init reactTutorialApp
react-native run-android
by followed these steps and it is installing on Device successfully. but i am getting a following error.
The development server return response error code:500
PFA
I think you forgot to run one command, the one to start the development server.
Try:
react-native init reactTutorialApp
run the following command in the project root folder, but in another tab (this process need to be running when you're developing:
react-native start
And now you can run: react-native run-android
Tell me if it solve your problem.
I have an android app use react native. The app run smoothly before. But for now it didn't run when I type command react-native run-android. I got error message like this:
Error type 3
Error: Activity class {com.test/com.test.MainActivity} does not exist.
And after that error, I can't run any new app. I run command react-native init app_name, cd app_name, and react-native run-android. The error message I got is:
The development server returned response error code:500
Anyone know how to resolve this? Thanks ^^
Problem solved!
Just type this command
npm install --save babel-preset-react-native#2.1.0