在本地应用程序中自动为设备设置调试服务器主机和端口

时间:2019-06-12 13:58:27

标签: react-native debugging react-native-android react-native-debugger

是否可以自动为本地应用程序中的设备设置调试服务器的主机和端口?

我必须触发此菜单并为我的应用程序设置代理,我希望在安装该应用程序时自动完成。有可能吗?

enter image description here

2 个答案:

答案 0 :(得分:0)

我为此写了一个小包,因为它让我发疯。看看here

npm i @nick-bull/react-native-debug-address

# DEBUG_HOST=127.0.0.1:8081 npx react-native start --port 8081
# or, equivalently
DEBUG_PORT=8081 npx react-native start --port 8081

npx react-native run-android --port 8081 

答案 1 :(得分:-1)

尝试一下:

添加到package.json脚本

PropertyChanged

然后运行以启动项目

"android": "react-native run-android --host=<ip-address>:8081"

或:

看看这个

  

How to modify IP & port use react-native Android?