Search code examples
androidvirtual-machinevirtualboxvirtualhostgenymotion

How do I modify the host file on a Genymotion VM from windows?


I'm basically trying to simplify my development workflow a bit. I have a azure mobile services project running inside IIS on my windows host machine, which I can connect to from the Genymotion Android VM using an IP address (10.71.34.1).

What I'd like to be able to do is connect to the mobile services website using a host header (e.g. http://devmobservices rather than http://10.71.34.1:12345).

How can I modify the host file opn the Genymotion VM to allow me to do this?

(Also, if there's a better solution then please point me at that!)

Thanks

Matt


Solution

  • To modify the host file, you need first to mount the system partition in read-write.

    After launching your Genymotion device, open a command line and type:

    adb shell
    mount -o remount,rw /system
    echo "10.71.34.1   devmobservices" >> /etc/hosts
    

    After that you will be able to reach your service through http://devmobservices:1234 address.