使用genymotion运行反应原生android调试打开http://10.0.3.2:8081/debugger-ui

时间:2018-03-05 07:04:17

标签: android react-native genymotion

描述

我在genymotions中运行反应原生android,当我打开JS调试时,Chrome操作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
  • react-native:0.53.3

1 个答案:

答案 0 :(得分:5)

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

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

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