简体   繁体   English

Genymotion:编辑/ system / etc / hosts文件

[英]Genymotion: Edit /system/etc/hosts file

I am currently trying hard to modify my Genymotion Android emulator's hosts file. 我目前正在努力修改我的Genymotion Android模拟器的主机文件。

The well-known way of remounting, pulling and pushing does not seem to work at all when using Genymotion, as the filesystem is always read-only and remounting is denied. 使用Genymotion时,众所周知的重新安装,拉动和推动方式似乎根本不起作用,因为文件系统始终是只读的并且重新安装被拒绝。

Earlier I recognized that Genymotion VMs are already shipped with superuser, so I opened the shell and su'd, but the problem is the same: the filesystem is read-only. 之前我认识到Genymotion虚拟机已经附带超级用户,所以我打开了shell并且su'd,但问题是一样的:文件系统是只读的。

Does anyone have an idea how to change that file in a Genymotion VM? 有没有人知道如何在Genymotion VM中更改该文件?

Thanks 谢谢

Arne 阿恩

Run Genymotion Android emulator and introduce this instructions in the console: 运行Genymotion Android模拟器并在控制台中介绍此说明:

  1. adb root adb root
  2. adb remount adb remount
  3. adb push /etc/hosts /system/etc adb push / etc / hosts / system / etc.

In the third step, specify your hosts file. 在第三步中,指定主机文件。

It works for me, I hope also works for you. 它适用于我,我希望也适合你。

I'm using this : 我正在使用这个:

ip="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)"
adb root
adb remount
cat /etc/hosts|sed 's/127.0.0.1/'$ip'/' > /tmp/hosts-adb
adb push /tmp/hosts-adb /system/etc/hosts

basically this gets your hosts file, change all 127.0.0.1 to your local network ip and send it to genymotion. 基本上这会获取您的主机文件,将所有127.0.0.1更改为您的本地网络IP并将其发送到genymotion。

Yes, this problem exists and adb root will not solve it on windows, it can't be edited/replaced from eclipse either. 是的,这个问题存在,并且adb root不会在Windows上解决它,它也无法从eclipse中编辑/替换。

Instead install Total Commander on Genymotion (if you have google apps installed its pretty simple), then go to file you want to edit and long press and select edit with Total Commander Editor. 而是在Genymotion上安装Total Commander(如果安装谷歌应用程序非常简单),然后转到要编辑的文件并长按并选择使用Total Commander Editor进行编辑。 It will ask for root priveleges, grant. 它将要求根权,授予。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM