簡體   English   中英

當react-native運行android錯誤

[英]when react-native run-android error

我試圖通過我的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環境變量。 但是我仍然遇到同樣的錯誤。

我還在我的電腦上安裝了Gennymotion,用於創建虛擬android設備。

通常會出現此錯誤,因為仿真器未運行或沒有連接設備。 因此,首先運行android仿真器,然后在項目文件夾中使用react-native run-android

嘗試使用cmd / PS / shell:

    java -version
    javac -version

如果javac返回錯誤,則說明您不是以管理員身份安裝jdk。 現在嘗試使用管理員卸載jdk

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM