Testing your websites on Android phones

Setting up an Android developer environment on your Mac is easy

Been reading up on web development/design for mobile devices recently, and came across some helpful instructions on testing websites on Google Android. Turns out it’s pretty easy, but I thought I’d write up these instructions for OSX since the steps seem to have changed a bit since the above article was written. You will need JDK 1.5 or higher to begin. Type “java -version” into your Terminal (Applications –> Utilities –> Terminal.app) to see what version you have.

You will also obviously need the Android SDK. If you just want to play around with the emulator or test websites, ignore the stuff on the installation instructions about Eclipse or other IDEs. If you meet the system requirements, download the right SDK version for your computer.

Once it’s downloaded, unzip it wherever is convenient for you (into a /code or /development directory, or just in your home directory).

Next, you will probably want to add the directory where android is to your system PATH. You can see what your path is by typing in your terminal “echo $PATH”. You will want to go to your home directory /Users/<yourloginname> and edit your .profile file. If it already has something that looks like this:

export PATH=/opt/local/bin:$PATH

Then just add the android directory onto the end like so:

export PATH=/opt/local/bin:$PATH:/Users/<yourusername>/android-sdk-mac_86/tools

When that’s done, close Terminal.app, restart it and type “android.” This will start the SDK and AVD (Android Virtual Device) Manager. You will not have any virtual devices downloaded/installed yet, so that will be your first step.

Click on “Available Packages” on the menu on the left side, and you will get a list of SDKs to download.

Check the box next to the latest one (in this case, SDK Platform Android 2.2, API 8, revision 2). Click “Install Selected” then click “Install”. The SDK will probably take a few minutes to download and install.

When it’s done installing, click on “Virtual Devices” then click the button “New” to create a new virtual device. Call it something like android2.2HVGA for the SDK and screen resolution (HVGA is for Half VGA). The size of the SD card doesn’t matter much for our purposes here, but it must be at least 9 MB. There are other configuration options you can tweak, but again we don’t need to worry about them now. If you want, you can change the skin to WVGA 800 or 854, which are common on the latest generation of Android phones.

Click the button to create the AVD, then select it from the Virtual Devices manager and click “Start…”, leaving the options at their default before you click “Launch”.

It will take anywhere from 30 seconds to a couple minutes to start (takes me a couple minutes on a MBP 2.53 ghz core 2 duo), during which you will see the following screens:

Eventually, you’ll see the home screen and you’re ready to go.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.