2017-06-02 98 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,現在與管理員