为Android修改hosts-无需重启
16lz
2021-01-24
至于为什么要修改hosts,相信你懂的。。。
在Android下,/etc是link到/system/etc的,我们需要修改/system/etc/hosts来实现。但是这个文件是只读,不能通过shell直接修改。可以通过连接到PC上使用adb来修改。
1、获得root权限:adb root
2、设置/system为可读写:adb remount
3、将hosts文件复制到PC:adb pull /system/etc/hosts hosts
4、修改PC机上文件
5、将PC机上文件复制到手机:adb push hosts /system/etc/hosts
至此,对hosts的修改就成功了。无需重启哦~!~
如果要查看是否修改成功,可以在PC上执行adb shell,运行cat /system/etc/hosts;或者在手机的终端模拟器上运行cat /system/etc/hosts。
更多相关文章
- 哥哥手把手教你认识AIDL的详细使用,来了老弟
- android实现拍照功能
- Android(安卓)Studio 工程依赖问题
- Android之JNI续
- android:weight属性的使用——android开发之xml布局文件
- android第二周小结
- Android(安卓)学习手札(一) 应用程序架构
- android 4.4 下载文件
- android 管理手机短信