React native emulator failed to start in windows10 - react-native

Does anyone knows how to fix this issue?
This is the exact command and result in windows 10.
react-native run-android
> info Running jetifier to migrate libraries to AndroidX. You can
> disable it using "--no-jetifier" flag. Jetifier found 864 file(s) to
> forward-jetify. Using 4 workers... info Starting JS server... 'adb' is
> not recognized as an internal or external command, operable program or
> batch file. info Launching emulator... error Failed to launch
> emulator. Reason: No emulators found as an output of `emulator
> -list-avds`. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
This is the actual screen shot.

Related

React-native gives 'native' is not recognized as an internal or external command, when creating new project

Hi I made a few app with react-native.They works fine without error.I run my applications with this command
react-native run-android --no-jetifier
Today I tryed to create new app with this command
react-native init myNewProject
It installed libraries etc. I opened it with vs code and run this command
react-native run-android --no-jetifier
Then it opends the avd device and gives this error. But my old projects works fine. Whats the problem.
Thank you.
The project
Error
'native' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Also
I installed this, it took a time
choco install -y nodejs.install openjdk8
Then I created project in react-native docs
npx react-native init AwesomeProject
But it still same
AwesomeProject> npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
'native' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

How could I launch the application without using "expo and emulator"

[1-npm install -g react-native-cli ]
create new project command
**react-native init MyAwesome **
run project
cd MyAwesome
connect my cellphone via laptop "developer mode and USB debugging mode is on also"
react-native run-android
C:\Users\ALL INDIA\Desktop\expMng> react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:9536) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 967 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
'C:\Users\ALL' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk-14.0.2\bin
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
error Failed to install the app. Make sure you have the Android development environment set up:
https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
You should set it with C:\Program Files\Java\jdkx.x.x.
\bin is not required.
Your android studio is not set up correctly.
Follow this to set the environment variable for android studio
https://reactnative.dev/docs/environment-setup
and do restart your PC after setup and give it a try

Hi guys I keep getting the error ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH

I keep getting
ERROR: JAVA_HOME is not set and no 'java' command could be found in
your PATH
Whenever I try to run react-native code from my terminal to use an android emulator.
I've recently been trying to set up react-native on my laptop through wsl because the virtual box has been giving me trouble using it.
I've set my ANDROID_PATH to C:\Users\username\AppData\Local\Android\Sdk and my JAVA_PATH to D:\Program Files\Java\jdk-13.0.1. But I keep getting the error.
info Running jetifier to migrate libraries to AndroidX. You can
disable it using "--no-jetifier" flag. Jetifier found 863 file(s) to
forward-jetify. Using 8 workers... info Starting JS server... /bin/sh:
1: adb: not found info Launching emulator... error Failed to launch
emulator. Reason: No emulators found as an output of emulator
-list-avds. warn Please launch an emulator manually or connect a device. Otherwise, app may fail to launch. info Installing the app...
ERROR: JAVA_HOME is not set and no 'java' command could be found in
your PATH. Please set the JAVA_HOME variable in your environment to
match the location of your Java installation. error Failed to install
the app. Make sure you have the Android development environment set
up:
https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment.
Run CLI with --verbose flag for more details. Error: Command failed:
./gradlew app:installDebug -PreactNativeDevServerPort=8081
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (/mnt/c/users/meron/Projects/react/New_project_7/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
I've tried everything but still no luck

Buid successful but Failed to connect to development server using adb reverse

My machine is: Ubuntu 18.04, react
First I open Android studio and turn on Virtual device:
Then I run command In two tabs Terminal:
tabs 1: react-native start
tabs 2: react-native run-android
And It show that:
BUILD SUCCESSFUL in 3s 27 actionable tasks: 2 executed, 25 up-to-date
/bin/sh: 1: adb: not found info Connecting to the development
server... warn Failed to connect to development server using "adb
reverse": spawnSync adb ENOENT info Starting the app...
BUT when I raun command: source $HOME/.bash_profile
and then I run: react-native run-android
It's ok
Why?
I've encountered the same problem on my Windows machine as well as my Ubuntu Linux machine. The fix that I found for both was to switch to version 10 of NodeJS. (I believe the problem is that Metro server doesn't seem to like v8, v12, or v13 of NodeJS, but v10 seems to work great)

Problem encountered in react native run android

I recently installed React Native on my Windows PC and I created a project but when i try with react-native run-android for android emulator it shows me:
C:\ReactNative\testproj>react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 855 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\Java
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (C:\ReactNative\testproj\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (C:\ReactNative\testproj\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at then.result (C:\ReactNative\testproj\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
Please help
Your JAVA_HOME is set incorrectly, go through the setup again, everything should works...
You can refer to this and check what is missing...