【问题标题】:Failed to transform react-native-reanimated-65-jsc.aar [closed]无法转换 react-native-reanimated-65-jsc.aar [关闭]
【发布时间】:2021-08-18 11:44:27
【问题描述】:
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 17.0.2、react-native 0.65.1 和 react-native-reanimated 2.2.0 中遇到了同样的问题。纱线卸载和纱线安装不起作用。纱线卸载和 npm install 确实有效。 (截至 2021 年 9 月下旬,运行这些命令时未指定版本)。
  • 只做一件事 tun 命令--npm uninstall react-native-reanimated

标签: javascript android reactjs react-native


【解决方案1】:

我认为 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@2.2.0 修复
【解决方案2】:

此问题已在最新版本(alpha 版本)中得到修复。

yarn add react-native-reanimated@2.3.0-alpha.3

这里是版本发布列表:https://www.npmjs.com/package/react-native-reanimated?activeTab=versions

【讨论】:

    【解决方案3】:

    新升级尚未发布 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 .. 设置它没有坏处

    现在按照以下步骤操作

    1. 在你的 android > gradle > wrapper>gradle-wrapper.properties 改变 distributionUrl=https://services.gradle.org/distributions/gradle-6.8-all.zip
    2. 安卓>构建。毕业。改变这两项;随着类路径与 6.8 一起设置,所有与 4.2.2 一起使用

    1. 卸载 react-native .65 并运行 0.64.2
    2. 删除你的 package-lock.json
    3. watchman watch-del-all
    4. 删除节点模块
    5. 运行纱线安装
    6. yarn start --reset-cache
    7. rm -rf /tmp/metro-*
    8. [这可以是可选步骤..因为设置了 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"))

    现在从您的构建开始。您应该不会看到报告的问题。

    。更新

    【讨论】:

    • 这个解决方案对我有用。唯一的区别是我必须使用 "artifacts.add("default", file("react-native-reanimated-64-hermes.aar"))" 而不是 "artifacts.add("default", file("react -native-reanimated-64.aar"))" 因为当我检查 node_modules/react-native-reanimated 文件夹时,只有 react-native-reanimated-64-jsc.aar 和 react-native-reanimated-64-hermes.aar文件。我正在使用 react-native-reanimated 2.2.0
    【解决方案4】:

    只需安装 react-native-reanimated@2.3.0-alpha.3 或任何更新版本。 它将解决此问题。

    【讨论】:

      【解决方案5】:

      更新到最新的 alpha 版本的 react-native-reanimated 将解决此问题。最新版本包含 react-native-reanimated-65-hermes.aar 和 react-native-reanimated-65-jsc.aar。所以它将在 react native 0.65 上运行

      【讨论】:

        【解决方案6】:

        我已经将我的 react native 版本升级到 0.65.1 并且也遇到了这个问题。尝试制作:

        1. npm 卸载 react-native-reanimated
        2. npm i react-native-reanimated
        3. cd 安卓
        4. ./gradlew 包装器
        5. cd ..
        6. npx react-native run-android

        【讨论】:

          【解决方案7】:

          如果你不想使用 alpha 版本的库,你也可以为 React Native 安装 react-native-reanimated@2.2.1 0.65

          【讨论】:

            猜你喜欢
            • 2020-11-22
            • 2022-11-30
            • 1970-01-01
            • 2022-11-17
            • 2023-02-11
            • 2023-02-01
            • 2021-12-25
            • 2020-03-28
            • 2022-06-29
            相关资源
            最近更新 更多