远程调试JS

时间:2019-05-03 07:15:39

标签: react-native react-native-android avd remote-debugging

我正在使用AVD在Windows上运行react-native应用程序。应用程序正在正常运行,没有错误。但是,当我尝试远程调试应用程序时,它抛出了一条错误消息:

  

无法连接远程调试器

     

连接流意外结束

enter image description here 我将设备的调试服务器主机和端口设置为localhost:8081。

怎么了?

1 个答案:

答案 0 :(得分:1)

调试代码的最简单方法是使用Chrome。您无需安装任何其他应用。在Android模拟器上,或摇动真实设备,您将看到应用程序内开发人员菜单。点击“远程调试JS”。 Chrome调试器将自动打开。您仍然需要在Chrome中手动打开开发者工具。在“源”选项卡中打开源文件,您可以在此处设置断点。 (2018年2月26日更新:由于React Native Android中的错误, 如果应用显示无法连接调试器,并且Chrome中的URL不是

http://localhost:8081/debugger-ui/,将URL更改为

http://localhost:8081/debugger-ui/,杀死该应用,然后重试。)

该网站的所有信誉:https://codeburst.io/react-native-debugging-tools-3a24e4e40e4

enter image description here

enter image description here