Installing Google Android SDK 1.0 On Ubuntu 8.04 Desktop PDF Print E-mail

Installing Google Android SDK 1.0 On Ubuntu 8.04 Desktop

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 09/24/2008

This guide explains how you can install the Google Android SDK 1.0 on an Ubuntu 8.04 desktop. With this stable release of the Android SDK, you can now develop applications for Android smartphones (like T-Mobile's G1) and offer them on the Android Market.

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

1. Preliminary Note
2. Installing Java And Eclipse
3. Installing Google Android SDK 1.0
4. Creating A First Android Application ("Hello, Android")
5. Links

 

 

1 Preliminary Note

I'm using the user name falko with the home directory /home/falko in this tutorial. Replace them with your own details where appropriate.

 

2 Installing Java And Eclipse

Before we can install the Android SDK, we must install Java and Eclipse (version 3.3 or 3.4 - I'm using 3.4 codename "Ganymede" here).

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

Click to enlarge

To install Java, we type

sudo apt-get install sun-java6-bin

(If you are on a x86_64 system, you also must install ia32-libs:

sudo apt-get install ia32-libs

)

Click to enlarge

You will be asked to accept the Java license during the installation:

Click to enlarge

Click to enlarge

The Android SDK 1.0 requires Eclipse 3.3 or 3.4. Ufortunately, the Ubuntu 8.04 repositories only have a package for Eclipse 3.2 - therefore we must install Eclipse manually.

Open a browser and go to http://www.eclipse.org/downloads/. Select one of the Java, Java EE, or RCP versions of Eclipse. I've chosen the Eclipse IDE for Java EE Developers for Linux 32bit (select Linux 64bit if you're on an x86_64 system):

Click to enlarge

Download the file to your hard drive, e.g. the desktop (/home/falko/Desktop):

Click to enlarge

To install Eclipse, we must open a terminal again. Go to the directory where you've saved the Eclipse file and uncompress it:

cd /home/falko/Desktop/
tar xvfz eclipse-jee-ganymede-linux-gtk.tar.gz

This creates a directory called eclipse.

Afterwards, you can delete the Eclipse archive file:

rm -f eclipse-jee-ganymede-linux-gtk.tar.gz

My eclipse directory is now located on my desktop (/home/falko/Desktop) - I don't want it there, so I move it to my home directory (you can leave it where it is or move it to whatever directory you prefer):

mv eclipse ~

Inside the eclipse directory, there is an executable called eclipse - that's the file we must run when we want to start Eclipse. Obviously, we don't want to do this from the command line, so we create a launcher for it.

Right-click on Applications and select Edit Menus:

Click to enlarge

Select Programming (or whatever category you want the launcher to be located in) and click on New Item:

Click to enlarge

Type in the name of the application (e.g. Eclipse) and the full path to the eclipse executable (/home/falko/eclipse/eclipse in my case) and click on OK:

Click to enlarge

Then leave the menu editor:

Click to enlarge

Now we can use the launcher to start Eclipse (Applications > Programming > Eclipse):

Click to enlarge

Eclipse is starting up...

Click to enlarge

... and asking for a workspace (you can accept the default one):

Click to enlarge

This is how Eclipse looks:

Click to enlarge

On to the Android SDK installation...

 

3 Installing Google Android SDK 1.0

To download the Android SDK 1.0, go to http://code.google.com/android/download.html, accept the license and click on Continue:

Click to enlarge

On the next page, select the Android SDK for Linux...

Click to enlarge

... and save it to your hard disk (e.g. on the desktop):

Click to enlarge

Now open a terminal again and go to the directory where you've saved the Android SDK and unzip it:

cd /home/falko/Desktop/
unzip android-sdk-linux_x86-1.0_r1.zip

We don't need the zip file anymore, so we can delete it:

rm -f android-sdk-linux_x86-1.0_r1.zip

We now have a directory called android-sdk-linux_x86-1.0_r1. In my case it's on my desktop - I don't want it there, so I move it to my home directory (you can as well leave it where it is):

mv android-sdk-linux_x86-1.0_r1/ ~

The android-sdk-linux_x86-1.0_r1 directory contains a subdirectory called tools (/home/falko/android-sdk-linux_x86-1.0_r1/tools in my case). We must now open ~/.bashrc and add the following line to it so that android-sdk-linux_x86-1.0_r1/tools is in our PATH:

gedit ~/.bashrc

[...]
export PATH=${PATH}:/home/falko/android-sdk-linux_x86-1.0_r1/tools
[...]

Next, we must install the Android Eclipse plugin. In Eclipse, go to Help > Software Updates...:

Click to enlarge

Go to the Available Software tab and click on Add Site...:

Click to enlarge
 

The Add Site window opens. Fill in https://dl-ssl.google.com/android/eclipse/ and click on OK:

Click to enlarge

Back on the Available Software tab, select Developer Tools (this should automatically check Android Development Tools and Android Editors) and click on Install...:

Click to enlarge

In the Install window, make sure that both Android Development Tools and Android Editors are checked, and click on Next >:

Click to enlarge

Click on Finish next:

Click to enlarge

The plugins are now being installed:

Click to enlarge

Eclipse must be restarted for the changes to take effect, so when you are asked if you want to restart Eclipse after the installation, you should select Yes:

Click to enlarge

After Eclipse has started again, we must update our Eclipse preferences to point to the Android SDK directory. Go to Window > Preferences:

Click to enlarge

If you see this message, click on OK and forget it:

Click to enlarge

Click on Browse...

Click to enlarge

... and select the Android SDK directory (/home/falko/android-sdk-linux_x86-1.0_r1 in my case):

Click to enlarge

Back in the Preferences window, click on Apply and then OK:

Click to enlarge

That's it, you can now use the Android SDK to create your own Android applications.

 

4 Creating A First Android Application ("Hello, Android")

This example is taken from http://code.google.com/android/intro/hello-android.html. It's a good test if your Android SDK is working as expected. We will create a small application that displays Hello, Android on an Android phone.

First, we create a new project (File > New > Project...):

Click to enlarge

Select Android Project and click on Next >:

Click to enlarge

Fill out the project details as follows:

Click to enlarge

Afterwards, you should see this window (navigate to HelloAndroid > src > com.android.hello > HelloAndroid.java > HelloAndroid > onCreate(Bundle) to see the source code in the source code window). Click on the Maximize icon in the upper right corner of the source code window to maximize it:

Click to enlarge

You should then see the source code in a bigger window. Modify the code so that it looks as follows:

package com.android.hello;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TextView tv = new TextView(this);
       tv.setText("Hello, Android");
       setContentView(tv);
   }
}

 

Save the file. To run the code, go to Run > Run Configurations...:

Click to enlarge

Highlight Android Application and click on the icon in the upper left corner that looks like a white sheet of paper:

Click to enlarge

The following window should come up. Fill it out as shown, click on Apply...

Click to enlarge

... and then on Run:

Click to enlarge

When you do this for the first time, the following message appears. Click on Proceed to continue:

Click to enlarge

Finally, the Android emulator comes up. It can take a while until the Android phone has started up (so please be patient), but afterwards you should see Hello, Android in the display:

Click to enlarge

Congratulations, everything is working as expected!

 

5 Links

 

Source: http://www.howtoforge.com/installing-google-android-sdk1.0-on-ubuntu8.04-desktop

Comments (3)Add Comment
Must explicitly set Java version
written by Mark , October 25, 2008
Great article, everything work for me with one small exception.

After I installed the new version of Java, running java -version at the command line still showed java-5. I had to then run:

sudo update-java-alternatives -l (which displayed the version of Java I had just installed)

I then ran:

sudo update-java-alternatives -s java-6-sun

After that, everything worked perfectly.
report abuse
vote down
vote up
Votes: +0
Android
written by Cell Phones , December 31, 2009
The number of things you can do with cell phones now is amazing. The Android has very advanced capabilities, it is quickly becoming one of the most popular and sought after phones.
report abuse
vote down
vote up
Votes: +0
ugg boots
written by uggs outlet , January 18, 2010
Many womenswear trends ultimately cross over to the men's market, but not all. Take the Ugg boot. Ugg is really punting its footwear in uggs outlet the direction of gentlemen – motorbike boot-style Uggs, rugged waterproof Uggs – but we're not biting.

It can't be a matter of effeminacy; they're meant to be unisex. Those who first favoured the wool-lined sheepskin boot were not only men, but men of a macho stripe befitting footwear seemingly named after the main ugg boots for sale conversational gambit of the caveman: first world war aviators and sheep-shearers in rural Australia.



report abuse
vote down
vote up
Votes: +0

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security code
Write the displayed characters


busy
 

 

This domain is for sale! Please contact me via contact page!