React Native开发过程中,在Android
模拟器上,commond + m
,选择Debug Js Remotely
,模拟器卡在connecting to remote debugger
,或者报错提醒unabled to connect with remote debugger
。
解决方法
-
设置链接地址
commond + m
-->Dev Setting
-->Debug server host & post for device
输入ip和端口号,如:127.0.0.1:8081
-
命令行设置模拟器映射端口
adb reverse tcp:8081 tcp:8081
-
以上设置完成,再执行
Debug Js Remotely
,就可以链接debbger,但是会存在跨域问题。两种解决方案- 完全退出chrome,命令行执行
open -a "Google Chrome" --args --disable-web-security --user-data-dir
- 下载chrome浏览器插件 Allow-Control-Allow-Origin,安装之后,开启跨域模式。
网友评论