Saturday, January 23, 2010

How to Setup Android Development Environment

There are many ways to develop for Android and because of all the options it is sometimes a little daunting getting your environment setup. I found myself bouncing from web page to web page, not really sure if I had the right tools and if they were setup correctly. I wanted to document the process that worked for me.

Goal: Step by step instructions to install and configure your Android development environment for Windows.

Environment/tools: Here is the setup I have chosen to use.
  • Windows (I'm using Windows 7, but any flavor of windows will do)
  • Eclipse IDE for Java Developers (v3.5 Galileo)
  • Java Platform (JDK 6 Update 18)
  • Android SDK Tools, Revision 4
 Step 1. Install Eclipse IDE
I chose to use the Eclipse IDE for Java Developers (v3.5 Galileo). You can download the it here
  • This is a zip file and does not require installation. Just copy the eclipse folder into your programs directory
Step 2:  Install Java Platform (JDK 6 Update 18)
  • Select your platform

  • Now run the JDK installation. I did not change any of the default installation options. When complete continue to step 3.


Step 3: Download the Android SDK Tools, Revision 4

  • This does not require installation. Just unzip and copy the files. You can install the package anywhere but remember where you put as you will need to reference it in Eclipse. I happen to install it inside my eclipse folder.

Step 4:  Configure Android SDK


  • Launch "SDK-Setup.exe" located in the Android SDK install folder"
  • If you receive the following "Failed to fetch url https://dl-ssl.google.com/android/repository/repository.xml" we need to change the URL to not use SSL. Close the error dialog.
  • Press "Cancel" on the "Choose Packages to Install" Dialog
  • Select "Settings" in the left pane
  • Check "Force https://... sources to be fetched using http://"
  • Press "Save and Apply"
  • Select "Available Packages" in the left pane
  • Select "Documentation" (at the top of the list)
  • Select "Usb Driver Package, rev 3 (at the bottom of the list)
  • And then select any platform you want to develop. You can select all (be prepared for a long download) or you can select only the platfrom for you phone. The Nexus One uses 2.1 and the Droid for Verizon uses 2.0.1.
  • Check "Accept All" and Press "Install Accepted"

  • When done press "Close"
  • Now we are going to create a virtual device (AVD)
  • Select "Virtual Devices" in the left pane
  • Select "New..."
  •  Create the following new Android Virtual Device
    • Name: Android2.1
    • Target: Android 2.1 API Level 7 (Or which ever API you installed)
    • SD card Size: 4000 MiB to 32000MiB (16000 MiB shown)
    • Leave the rest at the default settings

  • Press "Create AVD". Be patient it may take a few minutes to create your new AVD.
  • Close the SDK setup. 
Step 5:  Configure Eclipse
(These instructions are for Galileo version of Eclipse. Please see this page for instructions if you downloaded the Ganymede version of Eclipse)

  • Launch Eclipse for the first time. You will be asked where you want to your workspace folder to be located. 
    • I used the default location. 
    • Check "Use this as the default and do not ask again" so you don't have to answer this question every time.
    • Press "OK".

  • Select "Help > Install New Software..."
  •  Press "Add..."
  • Fill out the Add Site information
    • Name: Android
    • Location: https://dl-ssl.google.com/android/eclipse/
    • Press "OK"
 If you get an error don't use SSL. change location from "https://dl-ssl.google.com/android/eclipse/" to "http://dl-ssl.google.com/android/eclipse/"
  •  After a connection is made and available tools are retrieved expand "Developer Tools" and select "Android DDMS" and "Android Development Tools"
  • Press "Next"
  • Press "Next" again.
  • Check "I accept the terms of the license agreements"
  • You may receive a Security Warning about unsigned content. Press "OK"
  • Done. Now you should restart Eclipse.
  • After rebooting we need to tell Eclipse where we copied the "Android SDK" in step 3.
  • Select "Windows > Preferences"
  • Select "Android" from the left pane. After you select "Android" you will receive an error. That is because it is not setup yet. We are setting it up now.
  • For the SDK Location, browse to where you installed the SDK.
  • Press "OK"
  • A dialog box will appear. If you want to send usage data to Google leave it checked, other uncheck it and press "Continue". This dialog box can sometimes get trapped beneath your window. Minimize Eclipse if you don't see it.

 You are now ready to build your first application. To create a "Hello World" app check out my post here. If you have any questions feel free to post a comment and I will do my best to answer.

    58 comments:

    Jørgen said...

    What a great tutorial! I didnt figure out how and where to get the software, and at least not how to set it up properly! Thanks for the great work man!

    Clifford Campbell said...

    Awesome guide, very detailed.

    Carl said...

    Very nice! I'm all setup now and ready for "Hello World" tomorrow. Thanks!

    Shravanthi said...

    Great article Greg!!

    The set up was quick and now am all set to kick start android dev...


    Thanks,
    Shravanthi Denthumdas

    Anonymous said...

    I am always so impressed when someone takes the time to help others. Thank you for the great work!

    Ed said...

    I just came over from the xda forum you posted, I appreciate your work man. I thank you for helping me out boss! Hopefully you don't get annoyed by some of my questions from time to time. I like to do things right from the begining and it seems I'm finding the right path. Between CyanogenMod, RA's image and now you, I think I'm going to achieve what I want out of this. Thank you.

    Corbin said...

    bit of an older post now, but thanks quite a bit for this. truly a big help to us aspiring droid developers.

    Anonymous said...

    Thanks

    Anonymous said...

    Woh Very Very Nice Tutorial very help ful thx alot...

    Anonymous said...

    Voila
    Thanks a lot man.

    Sylvia said...

    hello All.... M Sylvia Gilbert working with Android Application Development and i would like to say that this post is very useful & informative. Thanks....

    Anonymous said...

    Very nice job, I was wondering how to get started and found one of your posts on a programming forum. I don't have a phone yet, because I am not sure I can afford the monthly bill! But I love to program and for now I will just try and get up to speed with it all.

    Thanks,
    Rob

    jill said...

    cool

    Virgosys said...

    Hi
    I am using Eclipse Galileo 3.4 and getting Perm gen space error even though I have increased the memory size to 512MB.

    eclipse.buildId=I20090611-1540
    java.version=1.6.0_05
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
    Command-line arguments: -os win32 -ws win32 -arch x86
    Pl advise me what is to be fixed.
    TIA
    Rajiv

    Anonymous said...

    you rock!!!!!!!!!!!!!!!!!!!

    Anonymous said...

    Fantastic - thanks for the info. I want to start developing for Android and did not have a clue. Well done!

    Android Developer said...

    The tutorial is really very nice and informative , it gives detail information for every process of installing android development environment for windows in mobile phones. You have used exact pictures for demonstration. I haven't used this manual yet but really looking forward for this for sure... thanks.

    Sohaib said...

    Hi
    I have found this article very helpful for me. Thanks buddy for posting it and helping people like me. Images are great to explain,,,,

    Myshredz said...

    The blog is really nice one and full of information we appreciate the kind of information you have provided in this post. The information are so useful for all of us and we would like to thank you from the bottom of our heart for this wonderful information.The things you have discussed about in this post which are supposed to be very helpful for us. Because of these wonderful information in this post the blog can be viewed again and again.

    Vaibhav Uchil said...

    Thank you Greg, Great Tutorial. I can think of N places where i could have gone wrong.. This helped

    Anonymous said...

    Awesome! Thanks!
    (Note: maybe add specifically that the eclipse zip needs to be extracted in step 1)

    Anonymous said...

    Great job! Probably saved days (or maybe weeks) or work. None of this shows up in Add/Remove Programs so how can this entire enviroment be removed if I want to at some point?

    Anonymous said...

    without this guide i would've been screwed thanks man

    Sid said...

    Very nice tutorial Mate..

    Anonymous said...

    i am getting the error, failed to create SDCard :s please help.

    Mr. D said...

    hey tell me for eclipse helios plz...

    Anonymous said...

    awesomem yar.....:)

    Ping GOPALsTech said...

    While creating the AVD I am getting some SD card error. How to clear that.

    Ping GOPALsTech said...

    I reduced the SD card size to 4000 and it created that is because my C:\ drive has only 8GB free space, so I reduced the SD card 16000 to 4000 and it successfully create.

    Pearlson said...

    Thanks a lot dude....
    this was really helpful
    from - Massmasti

    MiltonChapman said...

    EXCELLENT !!!! VERY EASY TO UNDERSTAND WITH SCREENSHOTS !!!!

    Anonymous said...

    thanks.... great work

    Anonymous said...

    Thanks for the grate work!!!!

    Anonymous said...

    hello integration with eclipse and android is good. but I want monkey test to my project how can i do pls give steps starting to end .

    Anonymous said...

    Hey, very helpful steps. I noticed that you put android sdk into the eclipse directory. Is it correct ?

    Anonymous said...

    I'm a student from UK. This is a really nice tutorial for beginners in Android and eclipse. Thank you very much.

    Anonymous said...

    Thank you so much. I've been struggling to figure out how to run android, your tutorial helped me through it with ease :)

    Tess said...

    Thank you so, so SO much. You have no idea how much help this was!

    MoMo said...

    Hi,
    Thank you so much.
    But I have many problems with that.
    If you are still checking this site, I want to ask you a very long question.
    So, please let me know if I can ask you questions.

    Anonymous said...

    Really useful..
    Thanx lot.

    Anonymous said...

    great work dood !

    Anonymous said...

    Great Article... Excellent work. Thanks a ton dude.. U made my day n life too.. :) Keep going...

    Brian said...

    I have been looking for something like this for a while. Definitely going to bookmark this page. Perhaps you could include something about installing an SVN plug-in for eclipse?

    andrid said...

    superrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

    bd said...

    super Like ...Cheers ..!!!!!!!!!1

    Anonymous said...

    Great thanks

    Anonymous said...

    Still helping people 2 years on. Thank you.

    Anonymous said...

    Yes! Finally!! I found the most detailed guide! Phew... Thanks for this dude!

    kashif said...

    Loads of Thanks Bro. Really helpful and detailed. Thanks Again.

    Shobana S said...
    This comment has been removed by the author.
    Shobana S said...

    pls tel me netduino board is enough for porting android or arm9 i should use pls tell me the hardware description wat i should use and hardware codings n jus layout the procedure to get the final output..

    Shobana S said...

    pls tel me netduino board is enough for porting android or arm9 i should use pls tell me the hardware description wat i should use and hardware codings n jus layout the procedure to get the final output..

    Anonymous said...

    which is the latest version of android sdk
    tell link of latest sdk zip file
    can we use the latest sdk
    mail me @ htcexplorersgnr@gmail.com

    Anonymous said...

    So many thanks..
    very very useful... simple and very clear

    Keep up the good work :)

    Anonymous said...

    Thank you so much for this great tutorial!

    Anonymous said...

    Follow the instructions and just download the newest SDK (I downloaded the whole bundle) and placed that unzipped folder in the eclipse folder. Than at the point where you add the reference you just point to the new SDK folder, no problem.

    Motiur Rahman Shawon said...

    Please check it:Most easy way to set up android environment

    http://computerexclusive.blogspot.com/2013/11/android-development-environment-setup_17.html

    Mark Davis said...

    Truly professional, Exactly what i was looking for. Will bookmark this blog for future posts.Asset Mobile LLC is an online job board that allows its users to create jobs related to the mobile industry anything from apps, games for Andoid, iOs, Blackberry, etc.

    Post a Comment