Search

Wednesday, June 3, 2009

writing android hello world program using eclipse and creating Android Environment

Here is the complete steps to create and setup environment for android programming till writing a sample android application below are the easy step by step guide


Step1: Downloading required packages
First of all Download Eclipse IDE from Here and download Google Android SDK from Here

step2: Unpacking Downloaded Files
Now Extract the Android SDK and Eclipse and in the Drive ( D: or E:) which has sufficient space

step3: Create AVD follow below steps
AVD is Android Virtual Device (AVD) which is nothing but system image and device settings used by the emulator, to create AVD goto command prompt start-->run-->type "CMD" and press enter now navigate to the folder in which you have extracted android SDK example D:\android-sdk-windows-1.5_r2\tools and execute the below command as shown in below picture

in command prompt execute below line

"android create avd --target 2 --name my_avd "


step4: Configuring and installing ADT to your Eclipse Environment
1. Start Eclipse-->help-->Software updates..
2. In the window Select Available Software tab and click on Add site and enter Below URL

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

2.if you get error remove "s" from https in url and click ok
4. Back in the Available Software view, you should see the plugin listed by the URL, with "Developer Tools" nested within it. Select the checkbox next to Developer Tools and click Install
5. Now in subsequent window, select and check "Android DDMS" and "Android Development Tools" Click Next.

6. Restart Eclipse

step5: Now we have to point the Eclipse to the Android SDK Directory you downloaded



1. In eclipse select window-->Prefrences and select "Android" in prefrence window
2. Now find the Browse button as shown in Above Pic and point it to downloaded SDK directory and click on apply and ok as shown in above PIC
3. Restart Eclipse

step6: Creating the Sample Android Project
1. In Eclipse select menu File-->New-->Project
2. Select Android Project" as shown in below PIC

3. Fill in the Project Details as shown in below PIC

4. Click Finish

step7: Writing Sample Android Program to print on screen
Click on the ceveniproject.java class or other name specified during the creation of the project as shown in the PIC below


and you can write the below code in the right hand side of the screen editor After writing the code in eclipse select

package com.ceveni.org;

import android.app.Activity;

public class ceveniproject 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("ceveni");
setContentView(tv);
}
}


Run-->Run in the Run as window select "Android Application"


that's it if your code doesn't have any error you can see the emulator with the output as shown in below PICAnd between note that emulator takes almost 5 mins to launch show the output so be patient and wait for 5 mins after starting the emulator... if there is any mistake in this article or you can still improve it please point out

34 comments:

javaandroid said...

great article

Manjunath said...

Thanks :)

Anonymous said...

great info

videos online said...

dude this is too good.
I noticed the change in URL...and its tarunchandel.com.

This is ths the first thing I am ging to do once i come back... came online after a long time today... have been realy busy with project..and was pleasently surprised by the new look of your blog.
MAn ...you rock!!!

Unknown said...

thanks, very helpful

Anonymous said...

what does this 5554 means???

Pedriyo said...

It means the port to which the emulator is connected. You can use it if you want to launch adb commands over that emulator.

mobile application development said...

okay gone through the post, need to upload the entire code for getting the result. If any problem comes while performing the code, i will definitely write it to you.

Anonymous said...

thanks a lot boss thanks a lot...

Anonymous said...

You forgot to add:

import android.widget.TextView;

Anonymous said...

"And between note that emulator takes almost 5 mins to launch show the output so be patient and wait for 5 mins after starting the emulator."

That seems odd to me, is there a reason it's taking 5mins to launch. Will it take that long every time or just the first time emulator is launched?

Manjunath said...

My bad i forgot to add "First Time" in that sentence.

Anonymous said...

Hi Friends,
I run Your Code , But it shows the Default Window
of the emulatornot the code implemented in our sample. I am using windows XP , please Advise me
where I have Fault. Reply me at : anes(dot)pa@gmail.com

EWAVE said...

Thanks , for much information,

Anonymous said...

Sadly, doesn't work for me. Emulator launches but app does not run. :-(

computer hardware said...

Keep sharing such a wonderful information..!

Anonymous said...

Great

$$ YahoO_Akshay $$ said...

Sir, Appln will run... Bu always shown output as "android", even if i change the text in code ("ob.settext("asdas");)it also print ANDROID why??

andry yudha said...

I recently came accross your blog and have been reading along.
I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

Anonymous said...

Thanks Budd..............

ubaid said...

Very nice,

Anonymous said...

this is the best blog i seen ever

thanks a lot

Anonymous said...

its superb....,

Anonymous said...

Thnks... for the first tym i got introduced with android... thanks to u.... now i can go ahead with it....I have a project for my MSC IT

Anonymous said...

i like topic. Thanks!

Murli said...

Cool post! Its has become so easy to make a simple app now!! I have also Put a very simple explanation here for a simple hello world app! http://farasbee.com/blog/2012/03/07/developing-a-android-app-without-a-laptop-or-a-computer/

Raj said...

Great article, awesome resource

Unknown said...

Really good one for beginners....

Unknown said...

Awesome work dude..... really nice way to explain all the steps. . . . This is the good example for a developer who is really eager to start android applications

Abhi said...

Thanks Bro. Nice Article

Anonymous said...

hi all,
Am using netbeans while running my andriod projects the andriod emulator is not integrating with netbeans.

Wat should i do to integrate.?

Coder said...

Very helpful information easy and clear..
"5 mins to launch show" is there any way to reduce this time because it is waste of time. By installing new SDKs can we improve this time?

Ninja_Cake said...

If you already have an android device you can use the app called "AIDE" (Android IDE)

Meghna said...

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..

Post a Comment

Other Interesting Articles



Related Article Widget by Yogith

Search Powered by Google