关于如何使用genymotion虚拟设备安装react native的问题?

zwghvu4y  于 2021-09-13  发布在  Java
关注(0)|答案(1)|浏览(285)

我正在运行npm运行的android,我有一些问题需要帮助

@ 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

我安装了java、node和npm版本

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

我已经设置了java_home和android_home环境变量

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

0ejtzxu11#

您的环境变量存在问题。请检查您的电话号码
android sdk位置 ANDROID_HOME C:\Users\dell\AppData\Local\Android\Sdk ,
java位置
java 之家酒店 C:\Program Files\AdoptOpenJDK\jdk-11.0.9.101-hotspot\ grad卢之家酒店 C:\Users\dell\AppData\Local\Android\Sdk\gradle-6.6\gradle-6.6 希望这能解决你的问题。

相关问题