文章目录
修改手机的hosts
- 首先你的手机需要root
- 获得root权限:adb root
- 设置/system为可读写:adb remount
- 将hosts文件复制到PC:adb pull /system/etc/hosts /Users/xxx/yourpath(此时adb文件夹下已经有了复制到PC 上/Users/xxx/yourpath目录下)
- 修改PC机上文件
- 将PC机上文件复制到手机:adb push /Users/xxx/yourpath /system/etc/hosts
查看是否成功
如果要查看是否修改成功,可以在PC上执行adb shell,运行cat /system/etc/hosts;或者在手机上运行cat /system/etc/hosts。
hosts文件域名 一个一行不然会有问题
127.0.0.1 host1.example.com
127.0.0.1 host2.example.com