首页 > 解决方案 > Expo go 立即崩溃而没有错误消息(React Native)

问题描述

问题:

嘿 Stackoverflow。由于互联网问题,我上周只在网络模拟器中测试了我的 react native 应用程序。现在我想在Expo go,移动模拟器中尝试一下。但是一旦我连接到项目并且完全构建了 js,整个应用程序就会崩溃而没有错误消息。

我试图解决的问题:

我现在将我的手机连接到我的 Windows 电脑并运行这个 logcat 命令:adb logcat *:S ReactNative:V ReactNativeJS:V以这种方式获取错误消息。但我无法弄清楚问题是什么。

当我运行应用程序时,logcat 命令会记录下来:

10-19 13:54:39.731  9429 11453 I ReactNativeJS: Running "main" with {"initialProps":{"exp":{}},"rootTag":1}
10-19 13:54:39.801  9429 11453 W ReactNativeJS: Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in SDK 44.
10-19 13:54:46.209  9429 11682 I ReactNativeJS: Running "main" with {"initialProps":{"exp":{"initialUri":"exp://192.168.1.111:19000","shell":false,"manifestString":"{\"name\":\"productivity\",\"slug\":\"productivity\",\"version\":\"1.0.0\",\"orientation\":\"portrait\",\"icon\":\".\\/assets\\/icon.png\",\"splash\":{\"image\":\".\\/assets\\/splash.png\",\"resizeMode\":\"contain\",\"backgroundColor\":\"#ffffff\",\"imageUrl\":\"http:\\/\\/192.168.1.111:19000\\/assets\\/.\\/assets\\/splash.png\"},\"updates\":{\"fallbackToCacheTimeout\":0},\"assetBundlePatterns\":[\"**\\/*\"],\"ios\":{\"supportsTablet\":true},\"android\":{\"adaptiveIcon\":{\"foregroundImage\":\".\\/assets\\/adaptive-icon.png\",\"backgroundColor\":\"#FFFFFF\",\"foregroundImageUrl\":\"http:\\/\\/192.168.1.111:19000\\/assets\\/.\\/assets\\/adaptive-icon.png\"}},\"web\":{\"favicon\":\".\\/assets\\/favicon.png\"},\"_internal\":{\"isDebug\":false,\"projectRoot\":\"D:\\\\coding\\\\apps\\\\productivity\",\"dynamicConfigPath\":null,\"staticConfigPath\":\"D:\\\\coding\\\\apps\\\\productivity\\\\app.json\",\"packageJsonPath\":\"D:\\\\coding\\\\apps\\\\productivity\\\\package.json\"},\"sdkVersion\":\"42.0.0\",\"platforms\":[\"ios\",\"android\",\"web\"],\"developer\":{\"tool\":\"expo-cli\",\"projectRoot\":\"D:\\\\coding\\\\apps\\\\productivity\"},\"packagerOpts\":{\"scheme\":null,\"hostType\":\"lan\",\"lanType\":\"ip\",\"devClient\":false,\"dev\":true,\"minify\":false,\"urlRandomness\":\"2s-g42\",\"https\":false},\"mainModuleName\":\"node_modules\\\\expo\\\\AppEntry\",\"__flipperHack\":\"React Native packager is running\",\"debuggerHost\":\"192.168.1.111:19000\",\"logUrl\":\"http:\\/\\/192.168.1.111:19000\\/logs\",\"hostUri\":\"192.168.1.111:19000\",\"bundleUrl\":\"http:\\/\\/192.168.1.111:19000\\/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false\",\"iconUrl\":\"http:\\/\\/192.168.1.111:19000\\/assets\\/.\\/assets\\/icon.png\",\"id\":\"UNVERIFIED-192.168.1.111-productivity\",\"isVerified\":true,\"primaryColor\":\"#023C69\"}"}},"rootTag":1}

如果这很重要,这些是我的版本:

  "dependencies": {
    "@babel/preset-env": "^7.15.8",
    "@react-native-async-storage/async-storage": "^1.15.9",
    "@react-native-community/datetimepicker": "^3.5.2",
    "@react-native-community/masked-view": "^0.1.11",
    "async-storage": "^0.1.0",
    "date-fns": "^2.25.0",
    "expo": "^42.0.4",
    "expo-status-bar": "~1.0.4",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
    "react-native-color-palette": "^2.2.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-reanimated": "^1.13.1",
    "react-native-screens": "^3.8.0",
    "react-native-svg": "^12.1.1",
    "react-native-vector-icons": "^8.1.0",
    "react-native-web": "~0.13.12",
    "react-navigation": "^4.4.4",
    "react-navigation-drawer": "^2.7.1",
    "react-navigation-stack": "^2.10.4"
  },

我希望你能帮助我。随时使用我也可以运行的另一个 logcat 命令发表评论。

标签: androidreact-nativeandroid-studio

解决方案


我不确定这是否有帮助,但我也遇到了 Expo Go 的稳定性问题。它们的范围从我尝试从 Snack 运行 React Native 项目时突然崩溃到无法通过启动屏幕。我之前在 Google Play 上查看了 Expo Go 的评论,发现有几个人报告了多个稳定性问题。虽然通过 Snack 在线预览运行 RN 很方便,但我想我可能需要通过 CLI 为我的设备测试它。我希望这些问题能尽快得到解决。


推荐阅读