如何更改Android上的hosts文件

发布于 2024-12-10 11:58:42 字数 1459 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

生生不灭 2024-12-17 11:58:42

您已拥有 root 权限,但仍需要重新挂载 /system 才能进行读/写

$ adb shell
$ su
$ mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

转到此处了解更多信息:以读写方式挂载文件系统

You have root, but you still need to remount /system to be read/write

$ adb shell
$ su
$ mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

Go here for more information: Mount a filesystem read-write.

长伴 2024-12-17 11:58:42
adb shell
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

这假设您的 /system 是 yaffs2 并且它位于 /dev/block/mtdblock3 在大多数 Android 手机上执行此操作的更简单/更好的方法是:

adb shell
su
mount -o remount,rw /system

完成。这只是说重新挂载/系统读写,您不必指定文件系统或挂载位置。

adb shell
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

This assumes your /system is yaffs2 and that it's at /dev/block/mtdblock3 the easier/better way to do this on most Android phones is:

adb shell
su
mount -o remount,rw /system

Done. This just says remount /system read-write, you don't have to specify filesystem or mount location.

故人如初 2024-12-17 11:58:42

这在我的情况下并没有真正起作用 - 即为了覆盖主机文件,您必须遵循它的指示,即:

./emulator -avd myEmulatorName -partition-size 280

然后在其他术语窗口中(推送新的主机文件 /tmp/hosts):

./adb remount
./adb push /tmp/hosts /system/etc

That didn't really work in my case - i.e. in order to overwrite hosts file you have to follow it's directions, ie:

./emulator -avd myEmulatorName -partition-size 280

and then in other term window (pushing new hosts file /tmp/hosts):

./adb remount
./adb push /tmp/hosts /system/etc
凯凯我们等你回来 2024-12-17 11:58:42

最简单的方法可能是使用此应用主机编辑器。你需要有root权限

Probably the easiest way would be use this app Hosts Editor . You need to have root

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文