BUILD FAILED in 19s
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.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform react-native-reanimated-65-jsc.aar (project :react-native-reanimated) to match attributes {artifactType=android-aar-metadata}.
> Execution failed for JetifyTransform: C:\Users\Rahul\Desktop\lcorn\rb\node_modules\react-native-reanimated\android\react-native-reanimated-65-jsc.aar. > Transform's input file does not exist: C:\Users\Rahul\Desktop\lcorn\rb\node_modules\react-native-reanimated\android\react-native-reanimated-65-jsc.aar. (See https://issuetracker.google.com/issues/158753935)
* 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 19s
at makeError (C:\Users\Rahul\Desktop\lcorn\rb\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\Rahul\Desktop\lcorn\rb\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async runOnAllDevices (C:\Users\Rahul\Desktop\lcorn\rb\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:106:5)
at async Command.handleAction (C:\Users\Rahul\Desktop\lcorn\rb\node_modules\@react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.
PS C:\Users\Rahul\Desktop\lcorn\rb>
"react": "17.0.2",
"react-native": "0.65.0",
无法转换 react-native-reanimated-65-jsc.aar
我认为 react-native-reanimated 不支持带有 React Native 0.65.0 的 Android 上的 Hermes。我能够修复它并删除 react-native-reanimated 因为我不使用它。也许您可以将其删除或禁用 Hermes。
安装 react-native-reanimated@2.3.0-alpha.2 也修复了它。
新的升级尚未发布 react-native-reanimated-65-jsc.aar。
安装包后,导航到 node_modules 文件夹并搜索 react-native-reanimated。导航到 android 并查看是否可以看到以 65 结尾的任何内容..否则它将无法工作。
替代选项,[降级到 0.64.2] 它确实有效......但版本在构建后被重置。
这是要更新的关键文件之一node_modules> react-native-reanimated > android > build.gradle使其工作
按照网站上的说明进行操作
https://docs.swmansion.com/react-native-reanimated/docs/installation/
设置以下内容enableHermes: true .. 设置它没有坏处
现在按照这些步骤
- 在您的 android > gradle > wrapper>gradle-wrapper.properties 中更改 distributionUrl=https://services.gradle.org/distributions/gradle-6.8-all.zip
- 安卓 > 构建。毕业。改变这两项;随着类路径设置为 6.8-所有设置为 4.2.2
- 卸载 react-native .65 并运行 0.64.2
- 删除你的 package-lock.json
- 守望者 watch-del-all
- 删除 node_modules
- 运行纱线安装
- yarn start --reset-cache
- rm -rf /tmp/metro-*
- [这可以是一个可选步骤..因为设置了 RN .64]
现在回到 node_modules 文件夹并搜索“react-native-reanimated”文件夹并更改它
artifacts.add("default", file("react-native-reanimated-${minor}.aar"))
到
artifacts.add("default", file("react-native-reanimated-64.aar"))
现在开始您的构建.. 您应该不会看到报告的问题。
. 更新
此问题已在最新版本(alpha 版本)中修复。
yarn add react-native-reanimated@2.3.0-alpha.3
以下是版本列表:https : //www.npmjs.com/package/react-native-reanimated?activeTab=versions
只需安装 react-native-reanimated@2.3.0-alpha.3 或任何更新版本。它将解决这个问题。