Programming Android Apps: SDK and Eclipse (ubuntu)
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.
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.
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.
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.
Once you’ve created you Virtual Device(s) it should look like the following:
You can test these virtual devices and see how nicely the phones are emulated. This is much more useful once you begin writing applications.
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).
* 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
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.
You should then have a fully working eclipse with android plugin.
Now you should have everything setup in order to develop and android applications. I would recommend the google tutorials: