Tuesday, October 9, 2012

Changing hosts file in Google Android Emulator

Now a days lots of our developers are coming with the same question as how do they change the host file in android. So I thougt that it is worth sharing the steps
  • Start Android Virtual Device(AVD) from AVD manager via checking on the check boxes "Launch from Snapshot" &"Save to Snapshot on". Otherwsie the changes you will make via following the process will be ignored and it will take the default host file entries.
  • Run Android\android-sdk-windows\platform-tools\adb remount to make the image as writable
  • Run Android\android-sdk-windows\platform-tools\adb pull /system/etc/hosts c:\android to copy the hosts file to the machine
  • After making changes to the hosts file put it back to android via running Android\android-sdk-windows\platform-tools\adb push c:\android\hosts /system/etc
  • Note that 127.0.0.1 ip will be pointing to the emulator device and 10.0.2.2 will point to the computer where emulator is installed

 

No comments:

Post a Comment