首先找到 adb.exe(可以理解为一个远程操作安卓的命令输入工具) 所在文件夹,不同版本的地址不同(我的地址是D:\MuMuPlayer\nx_main,大家可以搜索一下),使用cmd 打开这里,执行以下命令:
获取权限
adb -s 127.0.0.1:7555 root
adb -s 127.0.0.1:7555 shell mount -o rw,remount /system
重置host
adb -s 127.0.0.1:7555 shell "echo 127.0.0.1 localhost > /system/etc/hosts"
adb -s 127.0.0.1:7555 shell "echo ::1 ip6-localhost >> /system/etc/hosts"
这里10.8.xx.xx 是你的ip地址 yyy.com是你host要代理的域名
adb -s 127.0.0.1:7555 shell "echo 10.8.xx.xx yyy.com >> /system/etc/hosts"
上面就配置成功了,以下命令查看host是否生效
adb -s 127.0.0.1:7555 shell ping -c 1 yyy.com
最后感谢谷歌gemini3.0太强大了,大大提高了程序员的开发速度,目前还有免费白嫖一年的活动,ai时代技术平权,所有人都是开发者,致敬AI!!!