Dealing with hosts on Android SDK Emulator – MAC OS X 10.8

I was getting some odd bugs with responsive design on some Android phones and need to test it. After spending an afternoon at the Shopping Mall annoying the everyone to let me test every Android phone I could find I decided to install the Android SDK on my MB Air running OS X 10.8

After some tweaks I managed to set the emulador working, there is plenty of tutorial online on that I couldn’t test my dev sites because I always use hosts and your localhost on the emulator (if using MAMP with port 80 or add the port after the ip eg

So my solution was:
As I use a define so I only change one file from dev to production I have a define for my WEB_URL the only question was to change that define:

	define("WEB_URL", "");	
	define("WEB_URL", "http://myhostname/");

BONUS TIP: Giving the Emulator localhost access

When you create a Avd you need to give it a name change myAvdNameHere to the name you gave Avd and this way you have access to localhost

emulator -avd myAvdNameHere -partition-size 128

More on this Emulator localhost acceess

Note to self:

cd ~/Development/android-sdk-mac_x86/sdk/tools/
./emulator -avd phone -partition-size 128

Leave a Reply

Your email address will not be published. Required fields are marked *