react-native - React Native Mac M1 Android Emulator:构建失败并出现异常
问题描述
我检查了类似的问题,但似乎无法找到匹配项。据我所知,我也遵循了所有可用的设置指南。
我正在尝试使用带有 Android Emulator 的 react-native CLI 在 MacBook Air M1 上创建一个 React Native 应用程序。当我尝试使用 npx react-native run-android 运行构建时,我遇到了构建失败,我真的不明白。
我正在从 Android Studio Arctic Fox 运行模拟器,使用 API 31 Android 12 Preview 'S' arm64 的 Pixel 5(显然必须运行 arm64 图像才能在 M1 上工作?)
我在下面附上了构建失败,但我不得不连接,因为它超过了 30k 个字符的限制。任何人都可以帮忙吗?提前致谢...
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/marccooling/WebstormProjects/RN_YTCourse/tut8_flexbox/android/settings.gradle'
* What went wrong:
Could not compile settings file '/Users/marccooling/WebstormProjects/RN_YTCourse/tut8_flexbox/android/settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 60
java.lang.IllegalArgumentException: Unsupported class file major version 60
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
...
1 error
* 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 1s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/marccooling/WebstormProjects/RN_YTCourse/tut8_flexbox/android/settings.gradle'
* What went wrong:
Could not compile settings file '/Users/marccooling/WebstormProjects/RN_YTCourse/tut8_flexbox/android/settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 60
java.lang.IllegalArgumentException: Unsupported class file major version 60
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
...
1 error
* 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 1s
at makeError (/Users/marccooling/WebstormProjects/RN_YTCourse/tut8_flexbox/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/marccooling/WebstormProjects/RN_YTCourse/tut8_flexbox/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/marccooling/WebstormProjects/RN_YTCourse/tut8_flexbox/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/Users/marccooling/WebstormProjects/RN_YTCourse/tut8_flexbox/node_modules/@react-native-community/cli/build/index.js:186:9)
解决方案
推荐阅读
- python - Python - 使用 pyplot 将二维数组映射到网格?
- android - onPress 不适用于提升的组件,背景被按下
- css - 如何使引导 4 列-排水沟等于容器填充?
- windows - UWP Mqtt 连接
- hyperledger-composer - : API 错误 (404): 网络 hlfv11_hyperledger 未找到
- safari - 如何启用 Safari ITP 调试模式
- c++ - 将不同类的成员函数指针存储在单个映射中
- php - 如何在 php 中读取 date_time_set 作为当前时间?
- android-studio - Gradle 项目同步失败并出现 ParseError
- javascript - 找不到模块'mysql'