问题
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:
- adb root
- adb remount
- 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