【问题标题】:when react-native run-android error当 react-native run-android 错误
【发布时间】:2017-06-02 05:44:37
【问题描述】:

我尝试通过我的 React 项目运行 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 facebook react-native react-native-android


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      试试 cmd/PS/shell:

          java -version
          javac -version
      

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-02-26
        • 2017-12-26
        • 2023-02-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多