当react-native run-android error

时间:2017-06-02 05:44:37

标签: android facebook react-native react-native-android

我试图通过我的React Project运行react-native run-android。之后,我收到如下错误。

  

在cmd中显示错误

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 Home和Path Environmental Variable。但我仍然得到同样的错误。

我还在我的电脑上安装了Gennymotion来创建虚拟安卓设备。

2 个答案:

答案 0 :(得分:0)

您通常会收到此错误,因为模拟器未运行或未连接任何设备。首先运行android模拟器,然后在项目文件夹中使用react-native run-android

答案 1 :(得分:0)

尝试cmd / PS / shell:

SendKeys

如果javac返回错误,那么您不是以管理员身份安装jdk。尝试卸载您的jdk,现在使用admin