React Native如何解决(无法初始化org.codehaus.groovy.reflection.ReflectionCache类)问题 [英] How solve (Could not initialize class org.codehaus.groovy.reflection.ReflectionCache) issue in react native

查看:982
本文介绍了React Native如何解决(无法初始化org.codehaus.groovy.reflection.ReflectionCache类)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ npx react-native运行Android信息正在运行jetifier将库迁移到AndroidX.您可以使用"--no-jetifier"标志禁用它.Jetifier发现有864个文件需要正向喷射.使用4名工人...信息正在启动JS服务器...信息正在启动模拟器...错误无法启动模拟器.原因:30秒内无法启动仿真器.警告请手动启动仿真器或连接设备.否则,该应用程序可能无法启动.信息正在安装该应用程序...

$ npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 864 file(s) to forward-jetify. Using 4 workers... info Starting JS server... info Launching emulator... error Failed to launch the emulator. Reason: Could not start an emulator within 30 seconds. warn Please launch an emulator manually or connect a device. Otherwise, the app may fail to launch. info Installing the app...

失败:构建失败,并出现异常.

FAILURE: Build failed with an exception.

  • 出了什么问题:无法初始化org.codehaus.groovy.runtime.InvokerHelper类

  • What went wrong: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解.

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.

https://help.gradle.org

在1m 23s内失败

错误无法安装该应用程序.确保您已设置Android开发环境:https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment .使用--verbose标志运行CLI以获取更多详细信息.错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort = 8081

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

失败:构建失败,并出现异常.

FAILURE: Build failed with an exception.

  • 出了什么问题:无法初始化org.codehaus.groovy.runtime.InvokerHelper类

  • What went wrong: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解.

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.

https://help.gradle.org

在1m 23s内失败

at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (E:\work\react-native\AwesomeProject1\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)

推荐答案

在Mac OS和React Native v0.62上,我有相同的错误.

I had the same error on Mac OS and React Native v0.62.

正确应用这些说明:反应本机环境设置

添加此变量解决了我的问题:

Adding this variable solved my problem:

export JAVA_HOME ="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"

这篇关于React Native如何解决(无法初始化org.codehaus.groovy.reflection.ReflectionCache类)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆