【问题标题】:react-native program is not installed on the emulator模拟器上没有安装 react-native 程序
【发布时间】:2020-12-05 02:38:21
【问题描述】:

我在 Windows 10 中使用 React Native 创建了一个新项目,但它不能使用 run-android 命令运行。

我会总结一下我做了什么,因为我认为所有的程序都安装好了:

  1. 我同时安装了 npm 和 node。
  2. Java 安装。
  3. React 安装。
  4. 在环境系统中设置了这些。
ANDROID_HOME ---> C:\Users\IHC\AppData\Local\Android\Sdk
JAVA_HOME--> C:\Program Files\Java\jdk-۱۴.۰.۱
path--> C:\Users\IHC\AppData\Local\Android\Sdk\tools
C:\Users\IHC\AppData\Local\Android\Sdk\platform-tools
C:\Program Files\nodejs\
C:\Users\IHC\AppData\Local\Android\Sdk
C:\Users\IHC\AppData\Local\Android\Sdk\emulator
C:\Program Files\Java\jdk-۱۴.۰.۱\bin 

错误是:

info Starting JS server...
info Installing the app...
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
        at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:43)
     .
.
.
.

        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.base/java.lang.Thread.run(Thread.java:832)

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 44s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
enter code here

【问题讨论】:

标签: android react-native


【解决方案1】:

你能检查一下安装的android版本,最新版本请参考https://www.npmjs.com/package/@react-native-community/cli-platform-android然后重试。

【讨论】:

    【解决方案2】:

    那就是安装好了,下面我做了

    1. 删除 jdk-14.0.1 并安装 jdk-8u261-windows-x64

    2. 首先运行 Oracle VM VirtualBox,然后运行 ​​Genymotion

    在powershell中

    1. npm start -- --reset-cache
    2. npm install -g npm@4
    3. react-native run-android

    【讨论】:

      猜你喜欢
      • 2019-12-21
      • 2017-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多