找不到变量:来自 <unknown> 的符号(仅在 Physical React Native Android 设备上)

Can't find variable: Symbol from <unknown> (on Physical React Native Android device only)

运行 最新版本的 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 错误截图:

有时,.yarnclean 在我的案例中会出错。

如果您有 .yarnclean 个文件,请删除 assets 行或删除文件。

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

最后是没安装好mobx

起初,我收到以下黑屏错误: https://i.stack.imgur.com/ExSlC.png

然后1~2秒后,画面会变成: https://i.stack.imgur.com/D74Ia.png

MobX >=5 不应该 运行 在 React Native Android 上直截了当。 然后我只需要确保按照这些步骤来获取它 运行ning:

    1. brew install coreutils
    1. npm install jsc-android --save
    1. 遵循 this 说明(在 Android Studio 上)
    1. 按照 this 进行故障排除。 (在 Android Studio 上)。对我来说,它抱怨一个名为 libjsc.so.
    2. 的文件
    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"
  }
}