使用adb修改手机hosts文件

一、 教程

  1. 获取root权限
adb root
  1. 重新挂载为可读可写设备
adb remount
  1. 将原hosts文件拷到本地

本地先创建一个空文件,然后再把手机中的hosts拷贝到该文件中。

touch <local file> && adb pull /system/etc/hosts <local file>
  1. 修改hosts文件

  2. 将修改后的hosts文件拷回手机

adb push <local file> /system/etc/hosts
  1. 重启
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
发布了91 篇原创文章 · 获赞 39 · 访问量 18万+

猜你喜欢

转载自blog.csdn.net/zy13608089849/article/details/82853225
今日推荐