2017-06-02 101 views
-1

我试着通过我的React Project运行react-native run-android。之后,我得到了如下错误。在cmd中when react-native run-android error

显示错误

C:\Users\ekkawit\Desktop\ReactNative\myapp>react-native run-android 
Scanning 557 folders for symlinks in 
C:\Users\ekkawit\Desktop\ReactNative\myapp\node_modules (15ms) 

Starting JS server... 
Building and installing the app on the device (cd android && gradlew.bat installDebug)... 
Error occurred during initialization of VM 
java/lang/NoClassDefFoundError: java/lang/Object 
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 

我安装了Android SDK和Android的设置家庭和路径环境变量成功。但我仍然遇到同样的错误。

我还在我的电脑上安装了用于创建虚拟android设备的Gennymotion。

回答

0

您通常会遇到此错误,因为仿真程序未运行或没有连接设备。所以首先运行android模拟器,然后在项目文件夹中使用react-native run-android

0

尝试在CMD/PS /壳:

java -version 
    javac -version 

除非javac返回错误,那么你就没有安装JDK的管理。尝试卸载您的jdk,现在与管理员