React native android app didn't start - android

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

Related

Expo / React Native Error : spawnSync lsof ENOENT

I am working currently on an expo app and I recently came up with this issue : when I run npx expo start and then I press a to open the app on an Android Emulator I get this error :
› Opening on Android...
› Opening http://127.0.0.1:19000/_expo/loading?platform=android on Pixel_4_API_33
Couldn't start project on Android: spawnSync lsof ENOENT
I tried different emulators but I still get the error everytime...
The error came from the fact that I did not have an ANDROID_HOME variable inside my PATH. I just followed the instructions here and problem solved !
Ensure that lsof command is in the system's PATH.
Also you can try the command npx expo start --clear

Why I receive this error while running react-native run-android?

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

Command: `react-native run-android` hangs at "info Starting JS server..."

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

React Native response error 500

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.

React native build failed: The development server returned response error code 500

enter image description here
Browser's console Error:
Bundling index.android.js [development, non-minified, hmr disabled] 99.3% (1074/1078), failed.
Error: Uncaught error in the transformer worker: /home/manish/donut/node_modules/metro-bundler/src/transformer.js
at _transform.then.catch.error (/home/manish/donut/node_modules/metro-bundler/src/JSTransformer/index.js:172:31)
at process._tickCallback (internal/process/next_tick.js:109:7)
Make sure you have run the npm server. From your project root folder
Open terminal cd project root and run the following command
npm start
And if you are using command to compile and run the app on device or simulator, then make sure you have run the
react-native run-android or run-ios
command from different terminal, to make sure you have not closed terminal which you run npm start.
And see whether server started successfully
This can happen if import is not proper. Example if I try to import something like this below
import renderIf from './renderIf';
and there is renderIf file present in my project.
So all these types of issues will get printed in npm server logs. See the logs and fix it accordingly.

Categories

Resources