Configure & Build android hello world sample application using eclipse.

In this tutorial, we do two tasks
1. Configure an android project in Eclipse
2. Develop and run an android hello world example

Android applications can be developed with the following IDE

1. Eclipse ADT
2. Android Studio
3. Existing IDE with ADT

Let us see how to develop android applications with the existing IDE (here Eclipse)

Required tools

1. ADT plugin
2. Eclipse 3.7.2 (Indigo) or greater
3. JDK 1.6 or above

1) Dowload ADT Plugin (Android Developer Tools )

Download the ADT Plugin from and add to eclipse
To add the ADT plugin to Eclipse:
Start Eclipse, then select Help -> Install New Software.
Click Add
In the dialog box, in the Name, enter “ADT Plugin“, for  location, click on Archive and               select ADT Plugin zip file (for eg. from the system downloaded above.                Then ok.

add adt pluginadd adt plugin1

2. Restart Ecplise

After restart, you should get the Android SDK manager in the tool bar. If not available in the tool bar, open Windows->Customs perspective-> Command Groups Availability-> Select Android SDK and AVD Manager from the available command groups.

3. Configure the ADT Plugin

       Add Android SDK. If you already don’t have Android SDK, please download it (installer_r23.0.2-windows) from and install. After install, android-sdk folder inside current folder is created that contains the SDK files.

           For Adding SDK to eclipse, Windows ->Preferences -> Select Android without expand, then give the SDK location (android-sdk) created in the local drive.

android add sdk

4. Download / Add some additional (extra) packages (For example, ARM EABI v7a System Image – Android Virtual Device (AVD) to run the android application, Android Support Library, etc.. ) using Android SDK and AVD manager

sdk manager

5. Now let us create a Hello World Project

In eclipse, File->New->Others->Android->Android Application Project OR press Ctrl N
Give the Application Name ,Project name (In our example, AndroidApps) and Package Name (here : com.test.androidapps)
Select Minimum required SDK, Target SDK , compile with and theme. I have selected Android 4.1 Jelly Bean

Note : For using 4.1 SDK, you need to download and add SDK packages as given in the step 4. i.e. using Android SDK Manager -> thne check Android 4.1 SDK , then download.

android step3

Then click Next ..
Select blank activity, then next.

Give Activity and Layout Name (here : Main and main) then Finish.
HereActivitity (Main) will be the default java file ( to be created and layout will be the main.xml that contains the details of interface to be created. The complete directory structure for the hello world application is given below.

android build structure

Some of the files you need to look into.

1. (inside src/com/test/androidapps) – activity file.
2. main.xml (inside res/layout)
3. string.xml (inside res/values) – contains string values.
4. AndroidManifest.xml (inside /res)
5. (inside gen/com/test/androidapps) -automatically generated by ADT based on the resource file layout/main.xml and values/string.xml
5. .apk file (inside bin) – final app generated after building the project

The following code creates the hello world application

Replace the following code with file

package com.test.androidapps;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class Main extends Activity {
TextView Message;
Button TouchMe;
    public void onCreate(Bundle savedInstanceState) {
        Message = (TextView) findViewById(;
        TouchMe = (Button) findViewById(;

     TouchMe.setOnClickListener(new View.OnClickListener() {
        	public void onClick(View v)
        		Message.setText("Congrs..This is your Android Hello World Application!");

Replace the following xml code with main.xml under res/layout


<RelativeLayout xmlns:android=""
    tools:context="com.test.androidapps.Main" >

    <TextView android:id="@+id/TextView1"
        android:text="@string/welcome" />

        android:text="Touch Me" />


Replace the following xml code with string.xml file under res/values


<?xml version="1.0" encoding="utf-8"?>

    <string name="app_name">AndroidApps</string>
    <string name="welcome">Welcome to Android Apps!</string>
    <string name="action_settings">Settings</string>


AndroidManifest.xml file will be

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    android:versionName="1.0" >

        android:targetSdkVersion="16" />

        android:theme="@style/AppTheme" >
            android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />


Note : @string means the values of the field will be replaced from string.xml.

6. Create an Android Virtual Device (AVD) an Emulator using AVD manager for running the above android application.
i) Select Android Virtual Device in the tool bar. If not available in the tool bar, add it as we did it in the Step 2.
ii) Click on Create and Start AVD as given in the picture.

avd create1avd create2
Note : Select Device , Target and Memory as per your requirement.

7. Run the sample android application by choosing the AVD created above.

run android1

You will get the below output.


Click or Touch the “Touch Me” button and the output will be as given below.



Reference :  Creating an Android Project


You may also like

Leave a Reply

Be the First to Comment!