【问题标题】:Unable to debug react-native app using debugger-ui无法使用 debugger-ui 调试 react-native 应用程序
【发布时间】:2020-11-26 19:02:17
【问题描述】:

这个查询可能早就解决了,但我找不到解决方案

尝试在 http://localhost:8081/debugger-ui/ 的帮助下调试 react-native 应用程序。为此,我在 android 模拟器中部署了该应用程序,单击 ctrl + m |选择了Debug 选项,但最终出现以下错误

Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome, Consider providing alternative methods to expose this method in debug mode, e.g. by exposing constants ahead-of-time, Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

为了解决这个问题,我经历了link1link2link3link4,但无法解决。任何人都可以在这方面提供帮助。

【问题讨论】:

    标签: android react-native debugging


    【解决方案1】:

    警告:仅用于调试(不依赖于 DeviceInfo)

    查看this 后,在整个项目中搜索react-native-device-info 导入并在两个地方找到并像这样初始化

    const uniqueId = DeviceInfo.getUniqueIdSync();
    const appVersion = DeviceInfo.getVersionSync();
    

    注释了这两行并分配了一些虚拟值,例如

    const uniqueId = `device`;
    const appVersion = `device`;
    

    然后就可以调试应用了

    【讨论】:

      猜你喜欢
      • 2021-12-09
      • 2019-08-03
      • 2019-03-23
      • 2019-03-27
      • 2021-12-09
      • 2016-08-28
      • 2017-10-20
      • 2020-12-11
      • 1970-01-01
      相关资源
      最近更新 更多