Google Android Hello World! with Eclipse

Android

 

Your decision to start development on a new platform depends on how easy it is to write a “Hello World”. This tutorial helps you set up the development environment and write “Hello World” in few easy steps. This tutorial assumes that you are already familiar with eclipse and its installation.

Step 1: Set up Eclipse

You can get the latest version of Eclipse from Eclipse Downloads. I am using Eclipse Classic 3.7.2 for windows for this tutorial. If you plan to install 64-bit version, make sure you have latest 64-bit version of Java Development (JDK) installed.

Step 2: Install Android Development Tools (ADT) Plugin

First we need to install Eclipse Plugin named Android Development Tools (ADT).

Its very simple to get this plugin installed. Just Open Eclipse IDE , go to Help>Install New Software…

Install New Software

An Install window will appear with Available softwares. Now enter following link provided by Google in “Work with” field:

https://dl-ssl.google.com/android/eclipse/

 

Installing ADT Plugin

A new update link will appear put a check mark and click on Next to start installation. After installation the Eclipse IDE would require a restart.

Step 3: Install Google Android SDK

There are two ways to get and install Google Android SDK.

1. Install new SDK (Recomended)

A “Welcome to Android” window appears for SDK configuration when Eclipse restarts after ADT plugin installation (Step 2).  You can choose between installing new SDK or use existing. If you choose first option, it will automatically download and configure SDK with Eclipse. You can also get SDK platform (Android APIs) version of your choice. Second option will allow you to locate SDK manually if you already have downloaded it.

Configure SDK

2. Use existing SDKs

If you skip above, you can Download Android SDK in zip format and configure it using preferences window Window > Preferences. Here you select Android from left side bar and set SDK location manually. 

Locate SDK

Locate SDK

Android SDK Manager Window > Android SDK Manager allows you to get any version of Android Platform any time. You can also get documentation, sources, samples and other stuff here. 

 

Android SDK Manager

 

Step 4: Create New Android Virtual Device (AVD)

Now we need to create a virtual device to run Android Application on Android Emulator. Go to Window >AVD Manager and select Virtual Devices. Click on New to create a Virtual Device, give it some Name and select Target Android Platform from the drop down list. If you are using 4.x.x version of Android Platform you need to get ARM EBI v7a System Image using Android SDK Manager (see the previous image) to create virtual device.

 

AVD Manager

Step 5: Create First Android Project

Create a new Project File >> New >> Project , a new wizard will appear to select project type,  select Android Project from Android and click Next from the wizard. Now you are to specify Project Name. A directory with this name would be created in yous system. Next is the Package Name the namespace actually where all your code will go.  Standard domain style is used for naming. Then Activity Name it is the name of the class that is created by ADT, the plugin we installed. And Application Name that will appear as title of your app. For example my settings are like:

Project Name: AndroidHelloWorld

Package Name: com.getsolved.android

Activity Name: HelloWorld

Application Name: My Hello World App

Now Click on Finsh. If the Finish button is inactive make sure that your are not missing any information discussed above and the Pakage Name follow the domain style.

Step 6: Run the App

Now click on dropdown next to run button, select Run Configurations, Double Click on Android Application, it will create new configuration. At right side just browse the the application you just created and click on Run button. Here you will see your output.

39 thoughts on “Google Android Hello World! with Eclipse”

  1. Hi,

    I was trying to create my first Android app yesterday, also a Hello World program. Unfortunately, I am getting some errors when I try to build the project.

    The ‘Problems’ section shows that there are problems with importing the ‘android’ package.

    Did you face similar problems? If so how did you resolve them? Waiting for your response.

  2. Well Mr. Vivek! Hopefully you have installed ADT(i have discussed in the post). The problem will be with the Installation of Android SDK. Please make sure that you did the step: “Installing Android SDK” exactly as i have discussed. You must have to locate the complete extracted directory instead specifying some folder inside. And make sure that the directory you specify is accepted.

    Best of Luck

  3. Have you guys seen this error?

    [2009-11-03 16:15:20 – HelloAndroid]New emulator found: emulator-5554
    [2009-11-03 16:15:20 – HelloAndroid]Waiting for HOME (‘android.process.acore’) to be launched…
    [2009-11-03 16:16:37 – HelloAndroid]emulator-5554 disconnected! Cancelling ‘com.example.helloandroid.HelloAndroid activity launch’!

    I can’t seem to run the hello world sample.

  4. Hi,

    I was trying to create my first Android app yesterday, also a Hello World program. Unfortunately, I am getting some errors when I try to build the project.

    The ‘Problems’ section shows that there are problems with importing the ‘android’ package.

    Did you face similar problems? If so how did you resolve them? Waiting for your response.

  5. I had a problem. When I run, there is no error, but I can only see the sentence after I push the button menu.

  6. The emulator takes long to load and install app but it loads all automatically. As it takes long it gives feeling that the button press is doing some trick.

  7. Pingback: How to increase storage of Android Emulator

  8. Pingback: Getting Started with Android | Lonely Coder

  9. i have recieved this error message please help me where is the problem

    HelloAndroid] emulator-5554 disconnected! Cancelling ‘com.example.helloandroid.HelloAndroid activity launch’!

  10. I just want to say thank you for posting these clear instructions for installing all the required components for the Android Hello World App. I started with no Eclipse installed and everything worked perfectly. When I ran the application it displayed on the Android Simulator, with no errors!

    Excellent job, thanks again! Have a great day!

    – Dave

  11. This is the most hardest platform to say just ‘Hello World’ I have ever faced. Getting started with emulator is just a big pain, and now sdk installer update, after nothing is working… It is supposed to be easiest part to say Hello !!! I have been googling and there are many people have difficulties with Hello World…

  12. Hi,

    I am trying to create my first android app, the classic hello world. I’m fairly sure I’ve followed all directions as listed but am seeing the following errors after attempting to run the code:

    [2011-07-13 18:43:17 – Emulator] invalid command-line parameter: Files.
    [2011-07-13 18:43:17 – Emulator] Hint: use ‘@foo’ to launch a virtual device named ‘foo’.
    [2011-07-13 18:43:17 – Emulator] please use -help for more information

    Any guidance would be greatly appreciated.

    Kyle

  13. Hi,

    I tried the hello world application.. but I am getting stuck at a particular point after I ‘Run’ it.. I have pasted below the output log..Nothing happens after the last line.. even though I keep waiting for more than an hour 🙁
    Any help would be highly appreciated..

    [2011-07-19 11:24:31 – HelloWorld] ——————————
    [2011-07-19 11:24:31 – HelloWorld] Android Launch!
    [2011-07-19 11:24:31 – HelloWorld] adb is running normally.
    [2011-07-19 11:24:31 – HelloWorld] Performing com.example.helloworld.HelloWorld activity launch
    [2011-07-19 11:24:31 – HelloWorld] Automatic Target Mode: launching new emulator with compatible AVD ‘Amit_avd’
    [2011-07-19 11:24:31 – HelloWorld] Launching a new emulator with Virtual Device ‘Amit_avd’
    [2011-07-19 11:24:41 – Emulator] Warning: No DNS servers found
    [2011-07-19 11:24:41 – Emulator] emulator: emulator window was out of view and was recentred
    [2011-07-19 11:24:41 – Emulator]
    [2011-07-19 11:24:41 – HelloWorld] New emulator found: emulator-5554
    [2011-07-19 11:24:41 – HelloWorld] Waiting for HOME (‘android.process.acore’) to be launched…
    [2011-07-19 11:25:31 – HelloWorld] HOME is up on device ’emulator-5554′
    [2011-07-19 11:25:31 – HelloWorld] Uploading HelloWorld.apk onto device ’emulator-5554′
    [2011-07-19 11:25:31 – HelloWorld] Installing HelloWorld.apk…
    [2011-07-19 11:26:02 – HelloWorld] Success!
    [2011-07-19 11:26:02 – HelloWorld] Starting activity com.example.helloworld.HelloWorld on device emulator-5554
    [2011-07-19 11:26:04 – HelloWorld] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.helloworld/.HelloWorld }

  14. @Kyle All you need to do is reinstall the Android SDK directly in C:\ Directory(C:\Android\….) when the installation wizard asks you to specify a location. For some reason the plugin doesn’t know how to handle the space between “Program Files”. I hope that solves your problem.

  15. hey guys

    i installed everything as mentioned above but when i start eclipse i get an error saying “Failed to initialize Monitor Thread: Unable to establish loopback connection”. then when I try running the hello android, it says

    Android Launch!
    [2009-06-28 22:55:34 – LunchList] Connection with adb was interrupted.
    [2009-06-28 22:55:34 – LunchList] 0 attempts have been made to econnect.
    [2009-06-28 22:55:34 – LunchList] You may want to manually restart adb from the Devices view.

    Can someone help me please!!!

  16. Hi,

    I was trying to create my first Android app yesterday, also a Hello World program. Unfortunately, I am getting some errors when I try to build the project.the bellow msg was apper.what can i do sir.

    [2011-12-19 10:22:19 – AndroinHelloWorld] Android Launch!
    [2011-12-19 10:22:19 – AndroinHelloWorld] adb is running normally.
    [2011-12-19 10:22:19 – AndroinHelloWorld] Performing com.example.AndroidHelloWorld.AndroinHelloWorld activity launch
    [2011-12-19 10:22:19 – AndroinHelloWorld] Automatic Target Mode: launching new emulator with compatible AVD ‘My_avd’
    [2011-12-19 10:22:19 – AndroinHelloWorld] Launching a new emulator with Virtual Device ‘My_avd’
    [2011-12-19 10:22:27 – Emulator] emulator: WARNING: Unable to create sensors port: Unknown error
    [2011-12-19 10:22:27 – Emulator] emulator: emulator window was out of view and was recentered
    [2011-12-19 10:22:27 – Emulator]
    [2011-12-19 10:22:27 – AndroinHelloWorld] New emulator found: emulator-5554
    [2011-12-19 10:22:27 – AndroinHelloWorld] Waiting for HOME (‘android.process.acore’) to be launched…
    [2011-12-19 10:22:59 – AndroinHelloWorld] HOME is up on device ’emulator-5554′
    [2011-12-19 10:22:59 – AndroinHelloWorld] Uploading AndroinHelloWorld.apk onto device ’emulator-5554′
    [2011-12-19 10:22:59 – AndroinHelloWorld] Installing AndroinHelloWorld.apk…

  17. am the begginer for android.ur explanation is nice and easily understandable.i was make the hello world program with the help of your site. there is no error but the required output will not come.plz help me sir.only blank emulator will be appeared when i was run this program.

    Balaji J on December 19th, 2011 5:09 am

  18. hi,when i try to make a new android project,after pressing the finish button i receive an error:the file did not find
    what should i do? please help me
    thanks

  19. plz can u suggest me how to generate the lyrics of songs in Android music players…plz recognize me and give me the solution its urgent..

  20. Very frustrated with the difficulty in getting a Hello World sample to run. This page is out of date as the ADT download no longer works. Another waste of time in the world’s record of sloppy attempts to supply developers with something that works.

  21. hii
    i tried the program
    well when i run the program on the output i just seee a black screen
    and no display of my text

  22. hi ,
    i have problem with emulator
    can you help me
    Waiting for HOME (‘android.process.acore’) to be launched…

    could not get wglGetExtensionsStringARB

  23. This is my problem,please rectify to this problem .
    [2012-08-24 17:27:57 – HelloApp] Android Launch!
    [2012-08-24 17:27:57 – HelloApp] adb is running normally.
    [2012-08-24 17:27:57 – HelloApp] Performing com.sree.helloapp.HelloApp activity launch
    [2012-08-24 17:27:57 – HelloApp] Automatic Target Mode: launching new emulator with compatible AVD ‘AVD2.3’
    [2012-08-24 17:27:57 – HelloApp] Launching a new emulator with Virtual Device ‘AVD2.3’
    [2012-08-24 17:28:18 – Emulator] Failed to create Context 0x3005
    [2012-08-24 17:28:18 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:28:18 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:28:18 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:28:18 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:28:18 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:28:18 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:28:18 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:28:18 – Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
    [2012-08-24 17:28:18 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:28:28 – HelloApp] New emulator found: emulator-5554
    [2012-08-24 17:28:28 – HelloApp] Waiting for HOME (‘android.process.acore’) to be launched…
    [2012-08-24 17:32:23 – HelloApp] emulator-5554 disconnected! Cancelling ‘com.sree.helloapp.HelloApp activity launch’!
    [2012-08-24 17:32:30 – HelloApp] ——————————
    [2012-08-24 17:32:30 – HelloApp] Android Launch!
    [2012-08-24 17:32:30 – HelloApp] adb is running normally.
    [2012-08-24 17:32:30 – HelloApp] Performing com.sree.helloapp.HelloApp activity launch
    [2012-08-24 17:32:30 – HelloApp] Automatic Target Mode: launching new emulator with compatible AVD ‘AVD2.3’
    [2012-08-24 17:32:30 – HelloApp] Launching a new emulator with Virtual Device ‘AVD2.3’
    [2012-08-24 17:32:37 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:32:37 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:32:37 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:32:37 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:32:37 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:32:37 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:32:37 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:32:37 – Emulator] Failed to create Context 0x3005
    [2012-08-24 17:32:37 – Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
    [2012-08-24 17:32:37 – Emulator] could not get wglGetExtensionsStringARB
    [2012-08-24 17:32:39 – HelloApp] New emulator found: emulator-5554
    [2012-08-24 17:32:39 – HelloApp] Waiting for HOME (‘android.process.acore’) to be launched…

  24. On click run button. I am getting following error

    Errors occurred during the build.
    Errors running builder ‘Android Package Builder’ on project ‘My Hello World App’.
    sun/security/x509/X500Name

    Please help. Thank you.

  25. Hi,
    I could run my android application code properly but problem was that when i was expecting output in emulator I could only see text saying “android” not the output what i expected. This happened for all my applications. Is there any configuration modifications that will help to make my emulator work properly?

  26. in the error will be display
    pls resolve my problem
    [2012-04-30 17:20:27 – Emulator] Failed to allocate memory: 1455 [2012-04-30 17:20:27 – Emulator]

    [2012-04-30 17:20:27 – Emulator] This application has requested the Runtime to terminate it in an unusual way.
    [2012-04-30 17:20:27 – Emulator] Please contact the application’s support team for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *