Update Jan 2011: see new article
Following the recent posts on the Google Android platform, I thought it is time to go a little deeper in the programming world of this mobile device.
So the questions is:
– What do we need to start coding for Google Android?
Lucky for us, there are lots of tools available online, and the Android team has provided a comprehensive guide on this. You can read it here.
In just a few words:
1. you will be needing Eclipse, get it here. I’m currently using (actually I’m currently having installed, since I’ve moved to native C/C++ Android development), Eclipse IDE for Java EE Developers (163 MB) , jee-ganymede-SR2. Download it and install it.
2. the Google Android SDK, get it here . Current version at this time is 1.5.r1. To install the SDK you simply need to unzip it to a location on your PC. You will have a folder named android-sdk-windows-1.5_r1, and inside several subfolders (add-ons, docs, platforms, tools, usb_driver). Keep this structure intact.
3. Open Eclipse (start eclipse.exe from the installation folder), and go to menu, Help->Software Updates->Available Software->Add Site. Type in this address: http://dl-ssl.google.com/android/eclipse/, and press OK. Click the newly added check boxes and press Install. On the following Install window, “Android DDMS” and “Android Development Tools” must both be checked. Click Next/Accept/Finish and restart Eclipse when prompt to do so.
4. Add the SDK to Eclipse. Again in Eclipse menu, Click Window->Preferences->Android and browse to the location of the SDK folder you’ve unzipped earlier. Then click apply / ok.
First Android application
A good idea for a start is to try to compile one of the SDK samples. Android SDK comes with several samples developed in JAVA. Let’s see how we can get one running.
1. Open Eclipse, go to menu File -> New ->Project , select Android Project and click next. Now give it a name, eg. TestHello, and select “Create project from existing source”, and browse to %SDK_PATH%/platforms/android-1.5/samples select HelloActivity folder and click OK. You should get the source code imported.
2. Go to Menu Project -> uncheck Build automatically. Now you can right click your project name in the project explorer and select Build Project.
3. Go to \android-sdk-windows-1.5_r1\platforms\android-1.5\samples\HelloActivity\bin\ and locate TestHello.apk . This is the installer for your newly compiled app.
4. Using adb, from SDK tools, install the application:
adb install TestHello.apk
Next you can locate it in Android programs , and execute it with a simple tap.
Next you can modify the code, and learn new things. Hope you find this start-up useful.