Tuesday, December 20, 2011

Android development on Ubuntu 11.10 Oneiric

I decided to play around with Android development but I had a hard time finding good instructions on how to set up the Android development environment on Ubuntu 11.10. With a little trial and error I've figured it out. I'm posting my notes in hopes that they will be useful to me in the future and possibly to others also. The aren't a complete step-by-step guide and they assume you're comfortable with the Linux command line, but hopefully they'll be useful.

  1. Download and untar/gzip the Android SDK
  2. Install the JRE
    1. sudo apt-get install icedtea6-plugin openjdk-6-jre openjdk-6-jdk ia32-libs
  3. Install ant
    1. sudo apt-get install ant
  4. Set your JAVA_HOME and CLASSPATH
    1. export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
    2. export CLASSPATH=/usr/lib/jvm/java-6-openjdk/lib
  5. Update the build tools
    1. cd android*; ./tools/android update sdk --no-ui
  6. Download eclipse (Helios release) (Note the one in the Ubuntu repositories doesn't seem to work)
    1. google-chrome www.eclipse.org/downloads/
  7. Untar eclipse
    1. tar -xvf ./eclipse*.tar.gz
  8. Install the eclipse Android plugin
    1. eclipse : Help -> Install New Software ...
    2. enter: "Android Plugin"
    3. enter: "https://dl-ssl.google.com/android/eclipse/"
    4. Select 'Developer Tools'
    5. Click "Next"
  9. Restart eclipse
  10. Select the Android SDK
At this point you should have the Android SDK and eclipse installed and configured for Android development.

Here are some notes on doing Android development if you prefer to live on the command line instead of living in eclipse.

  1. Create and Android Emulator
    1. cd android*; ./tools/android -> Tools -> Manage AVDs
  2. Start the Android Emulator
    1. cd android*; ./tools/emulator -avd
  3. Create a new Android project
    1. cd android*; /tools/android create project --target android-14 --name HelloAndroid --path ../HelloAndroid.git --activity HelloAndroidActivity --package com.mydomain.helloandroid
  4. Compile your project
    1. cd ../HelloAndroid.git; ant debug
  5. Push your project onto your running Android emulator
    1. ant debug install

3 comments:

  1. Hi there, awesome site. I thought the topics you posted on were very interesting.
    I tried to add your RSS to my feed reader and it a few. take a look at it, hopefully I can add you and follow.

    Android App Development

    ReplyDelete
  2. Thank you! simple and straightforward instructions.

    ReplyDelete