Genymotion: Edit /system/etc/hosts file

浪子不回头ぞ 提交于 2019-12-31 10:38:07

问题


I am currently trying hard to modify my Genymotion Android emulator's hosts file.

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.

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.

Does anyone have an idea how to change that file in a Genymotion VM?

Thanks

Arne


回答1:


Run Genymotion Android emulator and introduce this instructions in the console:

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

In the third step, specify your hosts file.

It works for me, I hope also works for you.




回答2:


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.




回答3:


Yes, this problem exists and adb root will not solve it on windows, it can't be edited/replaced from eclipse either.

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. It will ask for root priveleges, grant.



来源:https://stackoverflow.com/questions/24206174/genymotion-edit-system-etc-hosts-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!