Setting Up An Android App Build Environment With Eclipse, Android SDK, PhoneGap (Ubuntu 10.10)

Version 1.0
Author: Falko Timme
Follow me on Twitter
Last edited 01/24/2011

This tutorial describes how you can set up a development environment for building Android apps on an Ubuntu 10.10 desktop using Eclipse, the Android SDK, and PhoneGap. I will describe how to build Android apps from the command line with PhoneGap and from the GUI with Eclipse and PhoneGap and how to test them in an Android emulator and on a real Android device. PhoneGap allows you to develop your Android applications using web technologies such as HTML, CSS, and JavaScript (e.g. with JavaScript libraries such as jQuery/jQTouch), and it will turn these web apps into native Android apps (in fact, PhoneGap supports multiple platforms such as Android, iPhone, Palm, Windows Mobile, Symbian, so you can use the same sources to create apps for multiple platforms).

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I will not explain how to develop an Android app using HTML, CSS, and JavaScript. You can find lots of tutorials about this on the Internet, e.g. this one:

Tutorial: A simple Twitter client with JQTouch

In fact, I'm using a slightly modified version of the Twitter client described in the link to build a Twitter app in this tutorial.

 

2 Installing Eclipse And Prerequisites For The Android SDK/PhoneGap

First open a terminal (Applications > Accessories > Terminal):

Eclipse and the prerequisites for the Android SDK and PhoneGap can be installed as follows:

sudo apt-get install openjdk-6-jdk eclipse ruby rubygems ruby-dev git ant libxml2 libxml2-dev libxslt-dev

Next run

sudo gem install nokogiri

 

3 Installing The Android SDK

Open Firefox and go to http://developer.android.com/sdk/index.html. There you will find links for the Android SDK for the different platforms (Windows, Mac OS X, Linux). Copy the link location of the download for Linux (i386) (don't worry, this download works on both i386 and x86_64 platforms!)...

... and download and uncompress it as follows:

cd ~
wget http://dl.google.com/android/android-sdk_r08-linux_86.tgz
tar xvfz android-sdk_r08-linux_86.tgz

This will give you the directory android-sdk-linux_86 in your home directory ($HOME). We must add the $HOME/android-sdk-linux_86/tools directory and the $HOME/android-sdk-linux_86/platform-tools directory to our PATH variable which we do as follows:

Open ~/.profile...

gedit ~/.profile

... and add the following line at the bottom of the file:

[...]
PATH="$HOME/android-sdk-linux_86/tools:$HOME/android-sdk-linux_86/platform-tools:$PATH"

To make the change effective (so that we don't have to log out and back in), run:

export PATH="$HOME/android-sdk-linux_86/tools:$HOME/android-sdk-linux_86/platform-tools:$PATH"

Now start the Android SDK:

android

This is how the Android SDK looks:

Select Available packages in the left panel and then select Android Repository in the right panel to download SDK packages:

The packages that belong to the Android Repository group should now all be checked. Click on the Install Selected button:

A new window opens; mark the Accept radio box and click on Install...

... to start the download of the SDK packages:

If ADB (Android Debug Bridge) needs to be restarted, click on Yes:

Click on Close after the download has finished - this will close the download window:

Share this page:

8 Comment(s)

Add comment

Comments

From: Android App Developers at: 2012-05-23 13:52:00

Everything in an app.

Majority of applications developed in 1 or more than two android features. But if we will apply more than 3 to 4 features then what we will expect  from that app if idea we have unique and superb  too.????

From: Phonegap android developers at: 2014-07-16 10:00:30

In terms of app experience, native apps can do more. They can easily get hold of swipe events, mutlitouch even, for those platforms which support it. They can typically act on hard keys being pressed, like Android's search button and volume controls. They can access hardware too, like GPS and camera. And with the user's permission, some platforms provide unfettered access to the operating system. Just try detecting how much battery remains with HTML5!

From: phonegap android application at: 2014-08-06 07:14:44

Very helpful and clean set of instructions which actually solves a quite complicated process due to the use of application dependencies plus versioning conflicts. I only had one problem with a node directory error. I did also find a solution which is quite simple. Thank you very much for such useful information.

From: little_oak at: 2011-01-25 19:45:30

NICE article.


 I purchased a book about android, but i have finished my search for best desktop with full suit for android.
NICE!


 I using ubuntu 10.10 :D.


 GREAT!

From: om at: 2011-02-26 16:20:05

I got a bit lost at the point where you created /tweetme/tweetme and magically had a load of resources with content (around point 7).


After paging through your tutorial again, I worked out that they came from here: http://www.timo-ernst.net/2010/08/tutorial-a-simple-twitter-client-with-jqtouch/


This is implied in point 1 "In fact, I'm using a slightly modified version of the Twitter client described in the link to build a Twitter app in this tutorial."


It would be very helpful if you could explicitly say in point 7 "I'm using an app I built earlier", and you can find the source code here: http://www.timo-ernst.net/wp-content/uploads/2010/08/tweetme.zip


But a very useful tutorial nonetheless.


Thanks 

From: Gary at: 2011-03-19 03:20:52

this tutorial help me so much………

but some confusion in getting this to work with the source code you reference as it's using php...

can you please send the source code of this tutorial in some zip folder so that i can run it easily……….

From: Anonymous at: 2011-05-25 00:25:16

I think the source_code.tar.gz in the root dir is the index.php it should be index.html not index.php. I got an error when i execute droidgap create pointing to the index.html but in the source its index.php. Thanks for the greate tutorials. I should start my android apps,  May i ask whats the best ebooks for beginners. 

From: xgenvn at: 2011-06-08 12:32:50

As I aware and have tried, in ubuntu 10.04, I use export PATH but it seems not working. So if anyone meets this problem, please cd to android-sdk-etc-etc/ and use the command ./android, it works like a charm.

Moreover, the size of the emulator window at my first run is a little bit bigger than my resolution, so I've searched around and find solution for this:

Follow  this link:

http://matthew-moses.com/main/2011/06/07/resizing-android-emulator-window/

Or follow my summary which I collect from that article:

- In Eclipse, navigate to window>Android SDK and AVD manager

- In the new opened window, choose the emulator you've used or been using (in this tutorial is mySim), click Edit.

- At Skin option: choose Built-in: HVGA

And finish your setting with clicking Edit AVD.

You may want to run the application again to check the setting out.

It seems an easy job on that, but for the newbie like me it'll save a little of time. Have fun.

Xgenvn