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

升级React Native 0.73 + Expo 50后启动应用时出现「Attempting to call JS function on a bad application bundle」错误求助

升级React Native 0.73 + Expo 50后启动应用时出现「Attempting to call JS function on a bad application bundle」错误求助

各位好!我在升级React Native和Expo之后碰到了一个启动错误,卡了好久都没解决,求各位大佬帮忙看看😭

错误内容:Attempting to call JS function on a bad application bundle: AppRegistry.runApplication()

我的升级操作:

  • React Native从0.72.6版本升级到0.73
  • Expo SDK从49升级到50
  • 按照RN 0.73的要求升级了Android Gradle Plugin(AGP,应该是8.x系列,具体是Gradle还是AGP我有点记混了)
  • 用expo run:android搭配Dev Client启动应用
  • 这个错误在Android模拟器和真实设备上都会出现

已经尝试过的解决方法:

  • 重新执行yarn install
  • 进入android目录执行./gradlew clean
  • 彻底删除node_modules、yarn.lock、.expo、.gradle等文件夹后重新构建
  • 找了相关讨论串,把里面的所有方案都试了一遍,但都没效果:Error calling Appregistry.runApplication in react-native

我的index.js代码:

import "expo-dev-client";
import { registerRootComponent } from "expo";
import messaging from "@react-native-firebase/messaging";
import App from "./App";
import { AppRegistry, LogBox, Platform } from "react-native";

messaging().setBackgroundMessageHandler(async (remoteMessage) => {
  console.log("Message handled in the background!", remoteMessage);
});

LogBox.ignoreLogs(["Require cycle: node_modules/victory"]);

if (Platform.OS == "android") {
  registerRootComponent(App);
} else {
  AppRegistry.registerComponent("main", () => App);
}

(注:原本registerRootComponent的注释提到它会自动调用AppRegistry.registerComponent('main', () => App),还能适配Expo Go和原生构建的环境,但我现在根据平台分开处理了注册逻辑,不知道是不是这里出了问题?)

有没有大佬在升级RN 0.73 + Expo 50时遇到过这个问题并解决了的?求给点思路,万分感谢!


内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.07 12:04:50