使用genymotion运行react native android debug打开http://10.0.3.2:8081/debugger-ui

Mar*_*ang 3 android genymotion react-native

描述

我在genymotions中运行react native android,当我打开JS Debugging时,Chrome op http://10.0.3.2:8081/debugger-ui而不是http:// localhost:8081 / debugger-ui /,因此genymotion日志无法连接调试,为什么?如何解决?

环境

  • macOS:10.13.3
  • 的Android:6.0.0
  • genymotion:2.12.0
  • 反应本机:0.53.3

nah*_*ang 5

让我们解决您的问题。请按照以下步骤操作:

  • 在模拟器中打开应用
  • Ctrl + M打开开发菜单,然后点击Dev Settings
  • 选择 Debug server host & port for device
  • 修改值127.0.0.1:8081或仅修改值,localhost:8081然后重新加载应用程序。现在,您将能够进行调试。

PS:某些教程可能建议您安装Chrome扩展程序以允许CORS,但这不是必需的。上面的方法比较简单。