gpt4 book ai didi

android - 找不到变量 : Symbol from (on Physical React Native Android device only)

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:09:14 24 4
gpt4 key购买 nike

运行最新版本的 RN,出现以下错误。但是,它只发生在物理 Android 设备上(尝试了两种不同的设备)- Android 模拟器和 iOS 都可以。

关于这是某种缓存问题(我怀疑是基于我所有的清除技术)还是代码错误,有什么想法吗?

我曾尝试按照与此相当相似的问题提出建议,但没有成功。

值得注意的是,我安装了 mobx,它之前曾导致此错误消息,尽管它总是显示来自那里,而不是在错误描述中显示未知。

非常感谢!

在 Android Studio 中我收到此错误(不确定这两者是否相关):

E/ReactNativeJS: Can't find variable: Symbol E/ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)

React Native 错误截图:

Error screenshot

最佳答案

我在使用 react-native init 创建的项目中设置 mobxmobx-react 时遇到问题。在我的物理设备 Android Samsung J7 Pro 上运行时,我遇到了这个非常相似的问题。

最后是关于mobx没有正确安装。

起初,我收到以下黑屏错误: /image/ExSlC.png

然后1~2秒后,画面会变成: /image/D74Ia.png

MobX >=5 不应该在 React Native Android 上直接运行。然后我只需要确保按照以下步骤让它运行:

    1. brew install coreutils
    1. npm install jsc-android --save
    1. 关注this说明(在 Android Studio 上)
    1. 关注this故障排除。 (在 Android Studio 上)。对我来说,它提示一个名为 libjsc.so 的文件。
    1. npm install --save-dev @babel/plugin-proposal-decorators
    1. 将我的 babel.config.js 文件更改为以下内容:
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]
]
}

这是我的 package.json 文件:

{
"name": "mobx_testing",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"jsc-android": "^236355.1.1",
"mobx": "^5.9.0",
"mobx-react": "^5.4.3",
"react": "16.6.3",
"react-native": "0.58.5"
},
"devDependencies": {
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "24.1.0",
"@babel/plugin-proposal-decorators": "^7.3.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.52.0",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}

关于android - 找不到变量 : Symbol from <unknown> (on Physical React Native Android device only),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54725301/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com