Categories
Android Dev Mac Tech Web

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 10.0.2.2 (if using MAMP with port 80 or add the port after the ip eg 10.0.2.2:8080).

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:

if($_SERVER["SERVER_NAME"]=="10.0.2.2"){
	define("WEB_URL", "http://10.0.2.2/myfoldername/public_html/");	
}else{
	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

Categories
Mac Tech

Delete files from Mac OSX desktop

Sometimes I get this bug that some odd files will show up on my Mac OSX Desktop and that no matter what I can’t delete.

I solve it by:
1-Open Activity Monitor (Applications->Utilities)
2-Search for Finder (Process Name Column)
3-Click it and Press Force Quit

If Finder doesn’t restart on it’s own, click the icon or restart.

Hope it helps