Skip to content

Programming Android Apps: SDK and Eclipse (ubuntu)

by mat on January 5th, 2010

Android is a brilliant smart phone operating system, this is the start of a short series of guides for starting to program applications for it using the android SDK.

Android SDK
Download the android SDK

Once downloaded untar the SDK

tar xvzf android-sdk_r04-linux_86.tgz

The SDK is not complete as additional files need to be downloaded in order to compile for different versions of android. Open the SDK and AVG management application by moving into the SDK folder and running the following.

sh tools/android

In the avaliable packages select the android versions you wish to develop for, and begin downloading them. Should this fail please read the next section, otherwise skip ahead.

Failing to download
If you cannot download from the google website, goto settings and select “force https://… source to be fetched using http://” and click save and apply.

android force http

forcing SDK and AVD manager http instead of https for android

If this still does not work (as was the case for me) it is possible that for some reason a configuration file was not created for this program, this can be solved by creating it manually:

echo sdkman.force.http=true > ~/.android/androidtool.cfg

Creating Android Virtual Devices
You can create virtual android phones using the SDK and AVD manager, click the Virtual Device tab and select new. Enter a name for the device, and a size for the sd card and simply click create AVD.

android create avd

creation of an android virtual device

Once you’ve created you Virtual Device(s) it should look like the following:

android avd's

Android Virtual Devices

You can test these virtual devices and see how nicely the phones are emulated. This is much more useful once you begin writing applications.

Android virtual device

Android Virtual Device in action

Eclipse

I would highly recommend using eclipse as it, along with the android plugin, greatly simplifies production and testing of applications.

Download eclipse from the ubuntu repositories (or from the eclipse website)

sudo apt-get install eclipse

If you do not already have java installed then you will need to install it.

sudo apt-get install sun-java6-jdk sun-java6-jre

You will need to add the following line to your .bashrc in your home folder so that the android tools can be used in eclipse (and other programs).

export PATH=${PATH}:/home/user/android/sdk/tools

* replace /home/user/android/sdk with the path to where you downloaded the SDK

Installing the android plugin for eclipse
Google’s eclipse plugin install guide.

In eclipse goto help then Install new software and then add the google plugin url

https://dl-ssl.google.com/android/eclipse/

Install software

Install new software in eclipse

Then install Android DDMS and Android Development Tools.

Should you receive errors (like I did) relating to a missing package you will need to add the eclipse repository and install the missing packages.

http://download.eclipse.org/releases/galileo

You should then have a fully working eclipse with android plugin.

Eclipse main window

Eclipse main window

What next?
Now you should have everything setup in order to develop and android applications. I would recommend the google tutorials:

6 Comments
  1. Dear Son

    This website is very pretty; i’m very proud of you mummys little soldier

    Love Mommy xx

  2. funny stuff jason.

  3. Hey mat, cheers for this. One thing though, why would you put the path export into the .bash_history? .bash_history only stores the recent bash commands, perhaps you meant .bashrc?

  4. Oh what a noobish mistake, it should be .bashrc thanks. I’ve updated the post now. Thanks

  5. I have problem with AVD emulator . Start and I wait and wait… I think is my Athlon XP 1700 … or something about settings …

  6. T.Terlemez permalink

    Hello,

    Thanks much.

Leave a Reply

Note: I am currently writing my thesis so probably wont have time to reply to your comment
Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS