一、 教程
- 获取root权限
adb root
- 重新挂载为可读可写设备
adb remount
- 将原hosts文件拷到本地
本地先创建一个空文件,然后再把手机中的hosts拷贝到该文件中。
touch <local file> && adb pull /system/etc/hosts <local file>
-
修改hosts文件
-
将修改后的hosts文件拷回手机
adb push <local file> /system/etc/hosts
- 重启
adb reboot
二、 示例
adb root
adb remount
touch /home/zengyu/hosts && adb pull /system/etc/hosts /home/zengyu/hosts
/** 修改hosts文件 **/
adb push /home/zengyu/hosts /system/etc/hosts
adb reboot