Hello World in Android Using Eclipse

This tutorial is a simplified, or at least condensed, version of the equivalent tutorial pages on developer.android.com, which are mostly fine, but they aren’t quite brainless enough to suit me. Plus, for the latest version of Android there was a missing step in there that made it impossible to create a new Android Virtual Device, so I’ve incorporated the fix for that as well.

  1. Download and install the Java Development Kit (JDK). As of this writing, the latest version of the installer is available at “http://www.oracle.com/technetwork/java/javase/downloads/index.html“.
  2. Download and install (or rather, extract) Eclipse. Eclipse is an open-source IDE (integrated development environment) that allows users to develop software in a variety of languages, and on a variety of platforms. As of this writing, a .zip file for the Windows version of Eclipse can be downloaded from “http://www.eclipse.org/downloads/“. Select the “Eclipse Classic” item from the list.
  3. Download and install the Android SDK Starter Package. As of this writing, the SDK is available at “http://developer.android.com/sdk/index.html“. When the installation is complete, the installer will automatically load the SDK Manager, and a list of packages that can be installed will be displayed.
  4. On the Android SDK Manager, click the Install button to install the recommended packages, which should be pre-selected. After the packages are downloaded (which seems to take quite a while), close the SDK Manager.
  5. Navigate to the directory to which Eclipse was installed and double-click the file “Eclipse.exe” to run it. A dialog will appear prompting for the “workspace” to use for this session. Click OK to accept the default and dismiss the dialog.
  6. Once Eclipse has loaded, select the “Help – Install New Software…” item from the main menu. The “Install” dialog will appear, and the first page of the dialog, named “Available Software”, will be visible.
  7. On the Available Software page, click the Add button. The “Add Repository” dialog will appear.
  8. On the Add Repository dialog, enter the value “ADT Plugin” in the Name box and ” https://dl-ssl.google.com/android/eclipse/ ” in the Location box, then click the OK button. Focus will return to the Available Software page, and a new item named “Developer Tools” will be available in the list box.
  9. Click the checkbox next to the Developer Tools item to select it, then click the Next button. The dialog will advance to the next page, named “Install Details.”
  10. On the Install Details page, review the items in the list and click the Next button. The dialog will advance to the next page, named “Review Licenses”.
  11. On the Review Licenses page, click the radio button labeled “I accept the terms” and click the Finish button. The Install dialog will disappear, and a new dialog named “Installing Software” will appear. The ADT plugin will load.
  12. When the plugin finishes loading, click the “Restart Now” button to restart Eclipse. Wait for Eclipse to restart, then click OK on the Workspace Launcher dialog to accept the default workspace (again).
  13. Once Eclipse has started, a dialog may appear titled “Welcome to Android Development”. Click the Next button on this dialog (and on the next page, which just asks whether Google can gather statistics on your usage of the SDK). Yet another dialog will appear.
  14. Click the Install button on the latest dialog to download and install the latest version of the Android SDK files.
  15. Once everything has finished loading and focus has returned to the Eclipse environment proper, select the “Window – AVD Manager” item from the main menu. A dialog named “Android Virtual Device Manager” will appear.
  16. On the Android Virtual Device Manager dialog, click the New button. The “Create New Android Virtual Device”, will appear.
  17. On the Create New AVD dialog, enter the value “AVDTest1” in the Name box, then select the appropriate value in the Target box. For this example, the value “Android 4.0.3 – API Level 15” was selected.
  18. Click the Create AVD button to create the AVD. The dialog should disappear, and focus will return to the parent dialog. If clicking the Create AVD button causes an error that says something like “unable to find a ‘userdata.img’ file for ABI armeabi” to appear in the Eclipse console pane, proceed to the next step.
  19. If an error occurs when clicking the Create AVD button, it may be necessary to select the “Run – Run Configurations” menu item to bring up the Run Configurations dialog, double-click the “Android Application” node in the tree view in the left pane to create a new configuration, click the Target tab in the right pane, click the “Automatic” radio button (even though it’s already selected), and then click the OK button. After that, it should be possible to create the AVD as described in the preceding steps.
  20. From the main menu, select the item “File – New – Project”. The New Project dialog will appear.
  21. On the New Project dialog, select the “Android – Android Project” tree node and click the Next button. The dialog will advance to the “New Android Project” page.
  22. On the New Android Project page, enter the value “HelloWorldAndroid” in the Project Name box and click the Next button. The dialog will advance to the “Select Build Target” page.
  23. On the Select Build Target page, accept the default target by clicking the Next button. The dialog will advance to the “Application Info” page.
  24. On the Application Info page, enter the value “com.example.HelloWorldAndroid” in the Package Name box and click the Finish button. The dialog will disappear, a new project will be created, and focus will return to the Eclipse workspace.
  25. In the Package Explorer pane, click on the “src” tree node, then the “com.example.HelloWorldAndroid” node underneath it, and then double-click the HelloWorldAndroidActivity.java” node underneath that to open it.
  26. Replace the contents of the HelloWorldAndroidActivity.java file with the following text, then save the file. This code is based on the sample on developer.android.com, with very slight modifications.
package com.example.HelloWorldAndroid;

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

public class HelloWorldAndroidActivity extends Activity 
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) 
        TextView txtHelloWorld = new TextView(this);
        txtHelloWorld.setText("Hello, world!");
  1. Select the “Run – Run” item from the main menu, select the “Android Application” item from the dialog that appears, and click the OK button. The Android emulator will start and boot (which may take a surprisingly long time), and then display the “Hello, world!” message.


  • As previously stated, this tutorial is basically a digest of information on developer.android.com. If the Android folks change the way things work a lot (which they pretty much do every release, apparently), it may render this tutorial invalid. Or at least less valid.
  • I found the workaround for the “can’t create an AVD” problem at “tech.thecoolblogs.com/2012/01/unable-to-find-userdataimg-file-for-abi.html”. I dunno, I guess it’s a pretty “cool blog”, but judging by the posts on the homepage, it seems kind of fakey/spammy/sleazy to me. Specifically, this week’s posts are about the nature of God, Epicurus, meditation for smoking cessation, free “antivirus” software, and printing free coupons right at home for big big savings! Anyway, credit where credit’s due, but I’d be afraid that they’re going to p0wn your box or something if you paste that link into your address bar. Or maybe I’m just being hypocritical. I mean, I have a sleazy blog of my own, after all. But at least mine’s on a relatively trustworthy domain, right?
  • A change to how wordpress.com works at some point made the sleazy link from that last list item live and clickable, so I had to remove the “http” protocol prefix to prevent that. Way to go, powers that be.
  • Sigh… Eclipse still has “workspaces”. They just won’t let it go.
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

2 Responses to Hello World in Android Using Eclipse

  1. Mayaa says:

    Thanks for the clean explanation.. This website http://www.compiletimeerror.com/2012/12/creating-first-androidapplication-in.html also addresses something similar.. Have a look, may help..

  2. Pavan @ ( Pavanh )
    Thank you for this tutorial , you can also check the same @ android hello world

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s