Android Studio Expo go立即崩溃,无错误消息(React Native)

y53ybaqx  于 2023-03-03  发布在  Android
关注(0)|答案(5)|浏览(154)
    • 问题:**

嘿Stackoverflow.因为互联网问题,我上周只在web模拟器上测试了我的react原生应用程序。现在我想在Expo Go,移动模拟器上试试。但是我一连接到项目,js完全构建好,整个应用程序就崩溃了,没有错误消息。

    • 我尝试解决的问题:**

我现在连接我的手机到我的windows pc和运行这个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命令,我也可以运行。

cs7cruho

cs7cruho1#

在我的例子中,我错误地输入了“fontStyle”而不是“fontSize”,这在ios中很好,但在android中连续崩溃,没有显示任何错误。

cu6pst1q

cu6pst1q2#

我不知道这是否有帮助,但我也一直有稳定性问题的世博会去。他们从突然崩溃时,我试图运行一个React原生项目从小吃到没有得到过去的启动画面。我早些时候看了世博会去Google Play的评论,发现有几个人报告了多个稳定性问题。虽然方便运行RN通过小吃在线预览,我想我可能需要通过我设备的CLI测试它。我希望这些问题很快得到解决。

zzzyeukh

zzzyeukh3#

在我的例子中,我让一个组件在第一个条件返回后使用useState钩子:

function Component() {

    // code

    if (condition) {
        return <LoadingScreen />
    }

    ... //code

    const [value, setValue] = useState() // this was causing an error

    return <View>
        ... // code
    </View>

}

当我将useState移到函数顶部时,在第一次返回之前,应用程序停止了崩溃

mbjcgjjk

mbjcgjjk4#

这已经有一段时间了,但在我的例子中,我使用flex:'33%'作为一个样式。从经验来看,如果你使用的CSS属性只有web expo支持,go似乎崩溃了,没有错误消息。

gjmwrych

gjmwrych5#

我也遇到了同样的问题,这让我抓狂。最后这个解决了它。在我的项目目录中,我运行:
npm安装-g暴露cli npx暴露cli升级
我收到“您当前使用的是SDK 47.0.0。是否要更新到最新版本48.0.0?”并回答是。
更新后,它的工作!🕺

相关问题