You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native Android打包失败:无法找到指定react-native aar文件

Android React Native打包错误求助

执行以下命令构建Android打包文件时出现错误:

ENV=production ./envscript.sh && ENVFILE=.env.production && cd android && npx react-native run-android --mode=ProductionRelease && ./gradlew bundleRelease

错误日志

> Failed to transform react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-art-profile, com.android.build.api.attributes.BuildTypeAttr=release, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
  > Could not find react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0).
    Searched in the following locations:
        https://jcenter.bintray.com/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0-release.aar

过往相关错误

之前升级React Native或尝试在build.gradle中添加apply plugin: "com.facebook.react"时,还遇到过以下错误:

  • Could not find Hermes.so
  • SoLoader: couldn't find DSO to load ...
  • Plugin with id 'com.facebook.react' not found

已尝试的解决措施

  • envscript.sh仅用于指定google-services文件路径,无其他影响
  • 切换到之前可正常打包的分支执行bundleRelease,仍然无效
  • 升级React Native到v0.72.0,问题未解决
  • 参考相关GitHub Issue方案,未解决

环境信息

react-native info输出:

System:
    OS: macOS 13.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 1.61 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.2.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 9.6.6 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.12.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK:
      API Levels: 28, 29, 30, 31, 32, 33
      Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0, 34.0.0
      System Images: android-28 | Google APIs ARM 64 v8a, android-28 | Google ARM64-V8a Play ARM 64 v8a, android-29 | Google APIs ARM 64 v8a, android-29 | Google Play ARM 64 v8a, android-30 | Google APIs ARM 64 v8a, android-31 | Google Play ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a
      Android NDK: 22.1.7171670
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7935034
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.6 => 0.71.6 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

已附上android/build.gradle、android/app/build.gradle以及MainApplication.java配置文件,请求协助解决打包问题。


内容的提问来源于stack exchange,提问作者Marion Gourlaouen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 09:13:23