Edit Android Hosts file

Android, Info.Tech, Mobile Development, Web Development Add comments

I have a project that needs to be compatible with mobile devices. What I want  is to redirect my emulated android or AVD to my PC, like browsing http://grass.dev in the android browser, will lookup to my other PC in local network.

This guide is for Windows and in my case I am using Windows 7. So, go to your installed directory of the Android SDK, then go to X:\…\sdk\platform-tools\ then cast the commands below (you will be using adb commands).

adb remount
adb pull /system/etc/hosts /tmp/hosts

Above commands is to pull the hosts file from the android you currently running. Next thing you will do is edit the file. In my case,

127.0.0.1		    localhost
192.168.7.126		    grass.dev

That’s the content of my new hosts file. Next you need to push back the file to the android.

adb push /tmp/hosts /system/etc

 

That’s it.. it should work. 🙂

 




Comments are closed.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in