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

升级React Native 0.72.3后遇libreanimated.so缺失问题求助

解决React Native 0.72.3中react-native-reanimated的libreanimated.so缺失问题

核心修复步骤

  • 彻底清理构建缓存
    执行以下命令清除所有相关缓存:
    # 清除npm缓存
    npm cache clean --force
    # 若用yarn则执行 yarn cache clean
    
    # 清除Android构建缓存
    cd android && ./gradlew clean
    cd ..
    
    # 重置React Native缓存
    npx react-native start --reset-cache
    
  • 验证Reanimated配置完整性
    检查android/app/build.gradle是否正确引入依赖:
    dependencies {
      implementation project(':react-native-reanimated')
    }
    
    同时确认settings.gradle包含:
    include ':react-native-reanimated'
    project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
    
  • 匹配Hermes与Reanimated版本
    确保android/app/build.gradle中启用Hermes:
    project.ext.react = [
      enableHermes: true,
    ]
    
    React Native 0.72.x适配Reanimated 3.3.0+版本,重新安装指定版本并确保依赖正确:
    npm install react-native-reanimated@3.3.0
    npx pod-install  # iOS端执行,Android端无需此操作
    
  • 指定兼容的NDK版本
    在android/build.gradle中设置适配的NDK版本:
    buildscript {
      ext {
        ndkVersion = "25.1.8937393"
      }
    }
    
  • 重新构建项目
    清理后重新编译运行:
    cd android && ./gradlew assembleDebug
    cd ..
    npx react-native run-android
    

额外排查项

  • 删除损坏的node_modules后重装依赖:
    rm -rf node_modules package-lock.json yarn.lock
    npm install
    
  • 暂时禁用其他动画类第三方库,排查是否存在冲突问题。

内容的提问来源于stack exchange,提问作者Swapnil Agrawal

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 14:47:05