Scanning folders for symlinks in F:\PROJECTS\ReactNative\albums\node_modules (246ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_144
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
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
Anyone can tell what's the problem, after I've run "react-native run-android" command.
That question's solution is type following command in cmd for following:
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
Related
When placing react-native run-android it marks me this error: error The application could not be installed. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run the CLI with the --verbose flag for more details.
Error: command failed: application gradlew.bat: installDebug -PreactNativeDevServerPort = 8081
the emulator I am using is the Genymotion
As it says follow the steps of setupping environment https://reactnative.dev/docs/environment-setup
Also, I can advise you to check your bash profile if you are using macOS.
Crete bash profile if it is not created by: touch ~/.bash_profile; in the terminal.
And after run in terminal to open open ~/.bash_profile
[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
I am trying to run the code created through react-native as AVD in android studio, but I am getting an error about the variable JAVA_HOME. What should I do?
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_131
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
Sometime we need to manually set the path (environment) of JAVA_JDK . Install latest JAVA JDK from official website. And set the path of jre and bin folder. After looking your directory C:\Program Files\Java\jdk1.8.0_131 I guess you are on windows , So I'm not sure how to set environment variable for windows but definitely you could get help from youtube.
After initializing my project with react-native init AwesomeProject I try to run it in the simulator via react-native run-android
However I get the following error:
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.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
However I followed the Getting Started Guide and the JAVA_HOME Evironmental Variable is set and C:\Program Files\Java\jdk1.8.0_221\bin is also in the Path var.
I am trying this on Windows 10 with the WSL bash.
I was able to fix this by creating a new project. The problem was that I run react-native init AwesomeProject from the WSL bash in windows. I could reproduce this.
When running the same init command in the command prompt it works.
I am trying to run the react-native run-android command in window 10. I set up the path to the SDK folder using ANDROID_HOME in System Variables of Environment Variables
ANDROID_HOME | C:\Users\owner\AppData\Local\Android\Sdk
And I also set up sdk.dir in the local.properties file
sdk.dir=C\:\\Users\\owner\\AppData\\Local\\Android\\Sdk
However, when I run the command lines
react-native run-android
in my project folder C:\Users\owner\Documents\React_Native\MyApplication> It gave me an exception as follow.
C:\Users\owner\Documents\React_Native\MyApplication>react-native run-android
Scanning folders for symlinks in C:\Users\owner\Documents\React_Native\MyApplication\node_modules (34ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 5.305 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