Search code examples
javareactjsnpmreact-nativegenymotion

question about how to install react-native , using genymotion virtual device?


i'm running with npm run android, and am having some problem need help

@ android D:\React-native\testproject
react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1275 file(s) to forward-jetify. Using 2 workers...
info Starting JS server...
info Installing the app...  
ERROR: JAVA_HOME is set to an invalid directory: D:\Java\jdk-16.0.1
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    
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output 
above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2021-07-27T04_18_16_409Z-debug.log

I installed java, node , npm of the versions

C:\WINDOWS\system32>java -version
java version "16.0.1" 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
C:\WINDOWS\system32>node -v
v14.17.0
C:\WINDOWS\system32>npm -v
6.14.13

I have set the JAVA_HOME and ANDROID_HOME environment variables

C:\Users\Admin\AppData\Local\Android\Sdk
D:\Java\jdk-16.0.1

Solution

  • There are issues with your environment varaibles. Please check your

    android SDK location

    ANDROID_HOME C:\Users\dell\AppData\Local\Android\Sdk,

    java location

    JAVA_HOME

    C:\Program Files\AdoptOpenJDK\jdk-11.0.9.101-hotspot\

    GRADLE_HOME

    C:\Users\dell\AppData\Local\Android\Sdk\gradle-6.6\gradle-6.6

    hope this will solve your problem.