Android Development 101 – A tutorial Series

Android is the prime OS for developing applications in today for many reasons. The main reasons being that it is Open Source and Intuitive. In addition it uses Java for development, which is quite an easy language to get used to and develop in. This being said, a lot of you have great ideas for Android applications or applications in general but don’t know where to start. This series will take you behind the scenes and introduce you to the software that will be your best friend while developing for android. On this journey we will start with a “Hello World” and move on from there to create a database driven application with a touch and scroll interface. The final result will look something like this:

Working with tools to develop Android applications will be your greatest asset as you will come to realize early on. All of the tools I use will be listed to make development speedy and efficient while still looking good along the way. At best you will need to acquire Eclipse, I recommend the Eclipse IDE for Java EE Developers version as it is amazing for other types of development as well. The next tools you will get are the Android SDK, which allows you to hook the SDK into eclipse to reference its API and design an efficient functioning program. After that, this part is optional, look into DroidDraw which is essentially a GUI for designing the interface side of things so that you don’t have to blindly hack your way through the Android SDK and Java jungle.


Eclipse is fairly straightforward to setup and start using the Android SDK, you just have to download a package to include the SDK to Eclipses referenced files. To do this we will go to Help and then to Install New Software. We want to click Add to be able to look up just Google’s packages they want us to download. In the location field enter https://dl-ssl.google.com/android/eclipse and click OK. Check both boxes and proceed to the next screen. You should make sure Android DDMS and Android Development Tools are both listed before going on. Accept license agreements and click Finish. You will have to restart Eclipse but after that your hook in is ready to be setup.

Android SDK is fairly straight forward to download for any system but updating it and hooking it into Eclipse is the key. After downloading the zip file (I’m using Windows/Linux but Windows examples will be default), unzip it to your C Drive and label the folder it will enter AndroidSDK. After entering said folder double click on the setup icon which will take you to the screen that shows you all the updates available for download. Download the latest updates and proceed to the top option Virtual Devices where you will make your first emulator. NOTE: if an update list does not show you will have to set the setup client to use http instead of https. When creating the emulator the name doesn’t matter and all you really need to set is a version you want to develop on. We will pick Android 1.5 from the list because if you decide to market an application you can reach more people and for the API’s we will use we don’t need 2.1 or 2.2. After setting up your emulator you are ready to have the two meet for the first time.

Going into Eclipse you will click the Window button and navigate to the Preferences option and click it. Select the Android option on the left and there will appear in the right side of the window a blank screen with a browse button. Click the button and find your AndroidSDK directory in the C drive and select that folder. Clicking Apply will make the blank window you were looking at show many different versions of the Android SDK and if you are able to see it you are on the right track. Click OK and we are ready to start developing.

NOTES: DroidDraw will be spoken about in another post in this series and we will use it to make part of our interface and the other half we will code ourselves. For everyone else developing in Linux I have found an awesome post that will describe how to set up your environment for Ubuntu and can possibly be transitioned for Red Hat and the like. Anyone who is having trouble feel free to let me know the issues you are having and I will try my best to not leave you behind before the next post.

If you can’t wait for the next post, browse the examples on the Android Developers website.

Articles used for reference:

Android Developers – Installing ADT Plugin

Continue on to Part 1, Hello world.

Comments

  1. Vote with your comments!

    If new stuff is coming to hackaday, let it be this!

  2. biozz says:

    great … very nice introduction
    glad you mentioned droid draw it helped me out so much on some of my apps bit it does not support the wvga screen on the droid (ironically)

  3. steaky says:

    why not just use this… http://appinventor.googlelabs.com/about/

  4. @Steaky

    I saw that this morning perusing the interwebs and as of right now you have to sign up for the access to it. I would love to check it out and see what the perks and products I develop would look like in App Inventor but they haven’t let me in yet…

    As of right now you can either code with an IDE or simply code in a text file that the SDK will generate and build using Android SDK’s built in commands. If you have access to this product let me know what you think as I am very intrigued by it already!

  5. biozz says:

    @steaky THANKS!

  6. samaral says:

    @Greg this is very informative, and @steaky thank you for the link. This is very interesting and I hope HAD can also look into this. A simple programming platform to control android and do stuff. cheers!

  7. Dick says:

    @Greg Good job man. Just the type of stuff this site needs. Now I hope some of the hardware folk can pick up on this style so I can get an intro to micro controllers and embedded electronics.

  8. David Rysdam says:

    Android is the prime OS for developing applications in today for many reasons. The main reasons being that it is Open Source and Intuitive. In addition it uses Java, which is quite an easy language to get used to and develop in.

    I count at least 4 false statements in here and I haven’t even gotten to the third sentence yet!

  9. Zutroy says:

    Great article. Software development is required for most hacking anymore. Thanks for the info.

  10. biozz says:

    @David Rysdam than you dont know android or general programming to well
    you blog backs up my statement

    nothing in this article shows me (as an android developer) that anything in this entry is false and Mr.Jacobs is a valued android developer so i trust what he says when the most complicated thing on your blog is a flipflop

  11. Anon says:

    @David Rysdam
    I can only find one thing wrong; Java. Who thought Java would be a good idea? They didn’t even include all of it. It now takes a page of code to work around the absence of some of the stream creating calls. It used to be like one line. So much butt-hurt…

  12. mowcius says:

    “for developing applications in today for many reasons”
    Well I see that mistake but I just read over it and didn’t really notice in the article.

    I think the article sounds good. Not really a droid guy myself and I am more into the hardware but I think it’s a good article none the less. I bet that as the new writers get more experience in writing articles to this bunch, the articles will also improve still. The first hackaday articles weren’t brilliant lets be honest, they have got much better over time.

    “So much butt-hurt…”
    Appropriate?

  13. @Anon

    I would agree on the Java front. The code should be C or some other language but after using it for development for so long it grows on you… just have to do twice the programming in C++ or C# to make up for it :)

    On a side note, Google was probably targeting the biggest language market share possible (since Google drives Java and Python dev in their products) to entice them to develop for Android to increase the number of apps in the Market (iPhone App Store catchup :( )

  14. M4CGYV3R says:

    Eclipse and Java for Android are pretty effective, but I really want a good start into the NDK and C++/OGLES2.0 programming.

    A redeeming post, Greg. Thank you.

  15. Anon says:

    Google would. The only way to get real work done is to go low-level on the Droid. Do you know if it’s possible to port python to Droid? It would be interesting and might even quench the fires of the great Python-Java flamewar. We could call it the 2010 Python-Java Peace Treaty.

  16. Anon says:

    @mowcius

    Appropriateness is relative. There are far more important things to worry about in this world than minor aesthetics (A.K.A. Reasons why I don’t care about recycling).

  17. Guiken says:

    Great article, looking forward to seeing more!

  18. Skywalker says:

    Great article, looking forward to seeing more!
    *some where else!!!!!!!!!!!!!!!!!!!

  19. why not 0 says:

    hmmm… so I’m a busy guy, wrapped up in my day job and haven’t done much investigation into Android, even though I own an Android phone.

    My personal interests are in such things as ‘how the hell do I write an app that does something useful on my HTC Hero/android Phone?’, ‘I have eclipse installed and I’ve done HelloWorld, but how do I hook up my android phone to my hardware/robot project?’.

    That would possibly be more focused for a hackaday article. If I wanted a how-to-create-an-android-app I’d have visited google. I visit HaD to go that extra step. maybe that is the lesson to learn here, HaD wants to grow, you can only grow by having constructive feedback and then act upon it.

    So, think of the audience, think of what you’re posting and then think of how the audience will perceive what you post. If you try to teach them to code java, then meh…. if you try to teach them how to code their Android device to interact with an AVR / PIC / Arduino then we may have something interesting that adds value and keeps us coming back for more….

  20. Anon says:

    @why not 0
    I believe there was already an article about Arduinos and Droids, however, it was probably shot down due to the use of the words ‘Arduino’ and ‘Android’.

    I have a feeling that if it doesn’t involve bluetooth or hacked up USB cable, it’s going to involve a lot of butt-hurt. ESPECIALLY WITH JAVA.

  21. Alex says:

    Excellent. Thank you :)

  22. acidblue says:

    Python on android, now that would be awesome.

    I’m just not a Java guy, Nice article anyway.

  23. kittens says:

    this has the potential to be an excellent resource for those new to the android platform, but please please -please- have somebody proofread your next article before submitting it.

  24. Robert Jordan says:

    Awesome! I have the HTC EVO and I have to say: “Android kicks buttocks.”

  25. fotoflojoe says:

    Like others here, I’m still getting my feet wet with Android development. Also, I’m pretty “meh” on Java. I know almost nothing about Python. All that being said, I did find this: http://google-opensource.blogspot.com/2009/06/introducing-android-scripting.html

  26. @fotoflojoe

    I had run into this article early on and quickly passed it by because I almost always have my computer on me to test or develop an app that comes to mind (tendencies of a nerd i guess :P). Looking at the script to turn the phone’s ringer on or off depending on its position now makes me think that HaD’s devout crowd could modify the script and possibly have it play an integral roll in any number of hack’s (one off the top of my head would be the shopping cart video posted today!) and is quite exciting

  27. Bill Woo says:

    Your instructions on updating Eclipse are incorrect :

    “To do this we will go to Help and then to Software Updates which will have a tab that says Available Software. We want to Add Site to be able to look up just Google’s packages they want us to download. In the location field enter https://dl-ssl.google.com/android/eclipse and click OK”

    And mis-leading. Please revise using the latest version of Eclipse.

    thanks, Bill

    • @Bill – The revision has been made, sorry about the confusion!

      Before Revision:
      “To do this we will go to Help and then to Software Updates which will have a tab that says Available Software. We want to Add Site to be able to look up just Google’s packages they want us to download. In the location field enter https://dl-ssl.google.com/android/eclipse and click OK”

      After Revision:
      To do this we will go to Help and then to Install New Software. We want to click Add to be able to look up just Google’s packages they want us to download. In the location field enter https://dl-ssl.google.com/android/eclipse and click OK.

  28. Sandro says:

    Nice tutorial, mentioned on Programmazione.it

  29. Stizzo says:

    Hahaha, ho fatto proprio così per l’esame di sistemi operativi :)

    Had I read this guide before I saved a long time

  30. Bob says:
  31. Wing says:

    Hey, just wanted to let you know that your Eclipse download link goes to version 3.6, and according to Google it seems that the ADT plugin has known issues with 3.6. I personally haven’t been able to get it working on 3.6—I install everything as specified but the Android option does not appear in the pref window.

  32. Nikita says:

    I installed Eclipse IDE for Java EE Developers 1.3.0.20100617-0521 and the latest Android SDK but “Android” option does not appear in the pref window.
    Any thoughts?

  33. Purchased a brand new Wildfire about a month ago as a business phone however am very dissatisfied , firstly i’d have about 900 contacts on my earlier XDA and was able to view by organisation or particular person, not so on Wildfire only by individual which is of no use particularly with no search possibility either. Android 2.2 is supposed to have search facility but not different view possibility launch date seems to vary every time . Battery fairly good approx 18 hrs medium usage. Bluetooth poor, paired with parrott automotive package okay for day or so however won’t connect even by unpairing and pairing new, identical drawback with bluetooth headset……..any ideas cannot find something on http://www.htcwildfireforum.com assist would be appreciated

  34. Nikita says:

    Hey Wing, we missed an important step. I got the up and working following these steps :

    http://developer.android.com/sdk/eclipse-adt.html

  35. patsbin says:

    Just wrote a german guide on how to set up Eclipse and ADT on 64bit Ubuntu 10.4.
    Maybe somebody can use it.

    http://www.carrier-lost.org/blog/android-entwicklung-unter-ubuntu-linux-eclipse-mit-adt-plugin

  36. Awesome series you have here!

    Thank you for mentioning my post!

  37. Big P says:

    Just started and finished part one of the tutorial. I’ve read through them all, and am anxious to continue! Great work!

  38. Ben says:

    When I installed the ADT Plugin and went into preferences, there was no sight of an Android tab on the left, I reinstalled it. Am I doing something wrong? I’m running Eclipse 3.5 with Eclipse IDE for Java Devs.

  39. Dave says:

    Thanks for posting these tutorials. I was able to get a simple app running in just a few minutes after grabbing the dev toolkit and emulator in my Eclipse install. No idea I could get started that quick. Looking forward to working through parts 2-5.

  40. s0m3b0dy says:

    i was updating the Android SDK but its taking forever any suggestions

  41. s0m3b0dy says:

    i was trying to set up the eclipse and SDK but it wont find any targets. i put all the software on a flash drive but the virtual device is on my hard drive. i put the location in the SDk location, it said tools could not be found so i set it as the location of the SDK file (which is on a flashdrive) but still no targets

  42. Mcgillicutty says:

    Does the AndroidSDK work with Windows7

  43. Mcgillicutty says:

    @s0m3b0dy

    I am having the same problem. I don’t know if it is my version of windows or what.

  44. Chris says:

    I followed your eclipse link and installed it as recommended. As someone mentioned, the link is to Eclipse 3.6, which the Android developer site says will not allow the ADT plugin to be installed.

    I didn’t realize this until later, and the funny thing is that when I installed Eclipse 3.6, the ADT plugin was already installed. The instructions you gave here went through with only one minor hitch. (I had to restart Eclipse to get it to reload the target list in the last step, but I had installed them after starting Eclipse.) All else looks fine.

    So do I have to worry about using 3.6? I noticed other people had problems with it, and the Android site does have a rather firm warning. Having gone through this, though, I’d prefer to continue rather than start again with 3.5.

    Thanks for a great series!

  45. Roger says:

    @Chris

    You wrote
    “Eclipse 3.6, which the Android developer site says will not allow the ADT plugin to be installed”

    The site does not say anything like this.

    The Android Developer Site recommends to to stay on 3.5. because of “known issues”. This is really easy to find, exactly where you would expect it. You _can_ install the ADT into 3.6 but you _will_ get strange errors in eclipse if you actually develop in 3.6.

  46. Hady says:

    I installed Eclipse IDE for Java EE Developers but “Android” option does not appear in the pref window.
    Any thoughts? anybody??

  47. Hady, did you install the Android Development Plugin? Do read this tutorial or mine to see how to do that.

  48. Sapnep says:

    I struggled a bit starting with ADT and eclipse. It took a while and with these resources I finally got it working out for me.
    Hady look at the preference window and put the correct location as below:
    SDK location = C:\Android\android-sdk-windows

  49. Almekhlafi says:

    Thankyou very much for this artical
    this best site about andriod system

  50. J App Me says:

    Eclipse(Galileo) closes every time i try to install the Google third party stuff in Android SDK manager.

    What is up with that???

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

Follow

Get every new post delivered to your Inbox.

Join 93,799 other followers