preload
Nov 08

Finally I found time to start looking at Android development. In the past I have been developing mobile applications on Java ME, Windows Mobile and Windows Phone 7, now it’s time to have a look at the Android platform. In this post I will describe what you need to do to get started with Android development.

At developers.android.com there is a good Quick Start guide explaining step by step what you need to do to get started:

  1. Start with installing JDK 6
  2. Download Eclipse Classic 3.6.1 and unzip it on your disk (I unzipped it to location c:\eclipse) Updated 9th Nov: There are know issues with the ADT plugin running on Eclipse 3.6, so to be safe download Eclipse 3.5. Thank you Robert Peterson for letting me know.
  3. Download Android SDK (for Windows platform in my case) and unzip it on your disk (I unzipped it to location c:\android sdk)
  4. Add the android sdk location to your path
  5. Install the Android Development Tools (ADT) plugin in Eclipse. Remote update/install site: https://dl-ssl.google.com/android/eclipse/
  6. Add Android platforms and components to your SDK by running the SDK Manager. I chose accept all and install, this will give me all available Android platforms and components including Google API, Usb driver, samples and documentation.

You have now installed all you need and you can now follow the steps below to create your Android project and run the application from Eclipse. Once again developers.android.com have a good tutorial on how to create Hello World application:

    1. Set the Android SDK location in Eclipse. Select Window –>Preferences –> Android and browse to your Android SDK location. When you click Apply you will see the list of SDK targets available.
    2. Create Android Virtual Device (AVD) in Eclipse. Select Window –> Android SDK and AVD Manager –> Virtual Devices and click on New. Give the AVD a name, select your target and click Create AVD. I named my AVD “Android_2.2_AVD” and selected the Android 2.2 target
    3. Create a new Android project. Select File –> New project –> Android –> Android project and click next. Then fill in the project details: Project name, Build target, Application name, Package name and Activity must be specified.
    4. The project is now created and is visible in the Package explorer, I called the project HelloAndroid so the class HelloAndroid.java is generated for me. In the HelloAndroid.java you can add code for your GUI:
package no.techcon.android;

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("My very first Android application");
        setContentView(tv);
    }
}
  1. Run the application. Select Run –> Run and run as Android. The Android Emulator will now start and boot up (takes a while to boot the first time). When the emulator is finished booting your application is installed and started in the emulator:

You are now ready to continue developing Android applications and explore the possibilities within the Android SDK.

Follow me on twitter @PerOla

Share & enjoy
You can subscribe to my comments feed to keep track of new comments.

4 Comments to “Getting started with Android development using Eclipse”

  1. Robert Peterson says:

    You did note Google’s comment on the System Requirements page that says, “Caution: There are known issues with the ADT plugin running with Eclipse 3.6. Please stay on 3.5 until further notice.”? That comment appeared very soon after Eclipe 3.6 shipped.

    In my testing I found the Android ADT plugin (versions 0.9.8 and 0.9.9) running in Eclipse 3.6 failed much more frequently than it should. As a result I continue to work in Eclipse 3.5 (Galileo) with ADT 0.9.9.

    Bob

  2. Hi Robert,
    I missed that note and went directly for Eclipse 3.6, so far I have not experienced any problems or issues. Thank you for the warning and I will go back to Eclipse 3.5 if I experience any issues when I continue developing with Eclipse 3.6 and ADT.
    I will change the Eclipse version in the post to 3.5 so I don’t fool anyone to install a version with known issues.

  3. Brian Nielsen says:

    Thanx, you’ve just helped my develop my first Android App :-)
    First impression is shadowed by a terribly slow virtual device.

    Brgds Brian

  4. Congrats on your first Android App Brian!
    The emulator (virtual device) takes a while to start. The trick here is to not close the emulator when you are done running your app. Just start and stop the app in Eclipse. This way you will not have to start the emulator each time your are running your app.

1 Pingback to “Getting started with Android development using Eclipse”

  1. […] Paul Graham at Pycon 2012 » My first android app – hello world! http://breathingtech.com/2010/getting-started-with-android-development-using-eclipse/ is a really good crash course in getting a dev environment […]

Leave a Reply

Subscribe to my comments feed

Subscribe to my feeds Follow me on Twitter
DZone MVB