So you wanna be an Android Developer?

I have talked to quite a few people lately about my plans. While many express a certain kind of doubt about the steps I am currently taking (most often quoting that dilbert comic), many others are curious about android and talk about programming some android “stuff” themselves. If you already know java, getting started is so easy, I thought I’d share the first few steps with you and give you some links to make it even easier!

So don’t just talk about programming android apps, do it! Follow these steps: I promise it takes less than an hour (unless you have a really slow internet connection!) and you’ll have hello world running on your device (or emulator) in no time!7+1 steps to conquer the world with your android app:

  1. Download the Android SDK and install it. This mostly means unpacking your download somewhere. I opted for my usual /opt/ but I am having trouble with that because I must run the manager as root now. Bonus step: you may also want to add the tools and plat-form tools folders to your path (see I have done this on a linux machine, how this part works on window – no idea).
  2. Download some SDKs: in your newly installed Android folder, run tools/android:
    • Go to “Available Packages” and check  whatever SDK Version you want to develop for.
    • To find out the version that is installed on your device: Go to Settings > About Phone > System version, from now on I’ll call that ‘your version’,
    • If you don’t have a device I suggest you choose 2.1 or 2.2 for now since those are the most common versions, if you want bleeding edge take 3.0 that’s just been out a few days (I was reminded last night that 3.0 is tablet only!).
    • You might want to download the samples as well.
    • Wait for the download to complete – should take only a couple of minutes.
  3. Eclipse Support: I am assuming you already have an eclipse installation? So now install die Eclipse addon, here’s the update url.
  4. Creating a project: Go to File > New > Android Project.
    • Give your project a name and choose your target version.
    • The application needs a name as well and a package. Take care with these two, if you want to publish your app that’s what the market sees. The Market is searchable by package name and the app name really is the public name as seen on your home screen and in the market.
    • Last enter the API Level of your chosen SDK Version into the MIN SDK Version field.
    • Hit Finish. Now you have your first skeleton project which is ready to be run in the emulator.
  5. First however take a look at the project: you should find the following
    • a source folder named src with java a java class (an activity!)
    • a source folder named gen with a generated java class (R.java, your connection to your xml files)
    • a build path entry with your SDK version
    • an empty assets folder
    • the res folder with some xml files and icons – this is where all your UI resources will go (most UIs are mostly xml and some png files)
    • the manifest for your application AndroidManifest.xml – this defines some important basics for your application, for example your activities (remember that when one of your first experiments doesn’t work). ADT also provides a nice editor for this file.
    • a default.properties file
  6. The emulator: In Eclipse go to to Window > Android SDK and AVD Manager and create an  AVD (‘Android Virtual Device’) with the New Button. Enter the following parameters:
    • Name = MyTestAvd
    • Target = your version of the SDK
    • SD Card Size = 16 (you can also roll some dice for the number, I think the minimum is 12)
    • For now leave the other options on default. (If you know your devices screen resolution you might want to use that of course, if you don’t know it exactly you can easily find out the resolution once you started programming a bit 😉
  7. Run your application on the emulator: so there you’re done. Not yet? Just hit “Run As Android Application”. This should start up the emulator. You’ll have to “unlock” it just like a phone and then the app starts and prints hello world (see screenshot at the top of the article).
  8. Bonus Round 1: Check out the “Log Cat” view in eclipse! It shows some logging, it will also show whatever you want to log in your application.
  9. Bonus Round 2: How about deploying to your device? Eclipse generates a deployable artifact in the bin folder (hint: it’s the *.apk). You can just copy that on your device in a multitude of ways:
    • enable your device for development and deploy with eclipse
    • copy on the SD card and use an App-Installer app to install it
    • download from the web

I hope this article was able to motivate a few of you to get started with your hello world. If you have any more questions please don’t hesitate to ask. I’d love to hear if any of you really did get started with android lately?

PS: I did finally publish my first app, more on that experience later 😉

This entry was posted in android. Bookmark the permalink.

6 Responses to So you wanna be an Android Developer?

  1. Uli says:

    I like to try android programming as well. Does somebody has a spare android phone…? (and some more time would be nice as well) 😉

    • Sonja says:

      You don’t really need a phone to start developing! The emulator does a really good job at it. As long as you remember your java basics you can quickly get going. You might want to also take a look at the download I posted as an example of the composite component to see what comes after the hello world.

      • Dimitri says:

        the emulator is so freaking slow….

        • Sonja says:

          Yes, it does have a few disadvantages. My biggest problem is that I cannot get it to emulate the screen size of my phone realistically. Therefore I must assume that it does not emulate any of the screensizes correctly. Basically this means I cannot test layouts in a dependable way.

  2. Luigi Fulk says:

    Hey there! I’m a first time reader of your blog…wanted to let you know that its very informative and to keep up the great work! Looking forward to your future articles!

  3. Jones says:

    Hi there!

    A nice page in german for starters is http://www.androidpit.de/de/android/wiki/view/Android_Anf%C3%A4nger_Workshop. With a little more information on developing an Android app.

    And yes, I just got started. I now have an app, which closes itself after pushing a button “close app”.
    I’m awesome, ain’t I? :-))

    PS: Also available in english as an pdf.
    http://www.androidpit.de/files/androidpit-beginners-workshop-2010.pdf