Thursday, February 9, 2012

Installing the Android SDK on Ubuntu 11.10

My harddrive failed, forcing me to reinstall my OS. I decided to upgrade to Ubuntu 11.10, so this is basically a rehash of my previous instructions for Ubuntu 11.04.

  1. Make sure that you have the 32bit compatibility libraries installed if you are using 64bit Ubuntu

  2. If you fail to install the 32bit compatibility libraries you will get an 'adb version' error at the end when you run Eclipse. If you are running 64bit Ubuntu, start out by installing the 32bit libraries

    ~$ sudo apt-get install ia32-libs

  3. Install the JDK
  4. This should be a straight forward step

    ~$ sudo apt-get install openjdk-6-jdk

  5. Download and install Eclipse
  6. Find and download an appropriate version of Eclipse. Since my last instructions for 11.04, the version of Eclipse in the Ubuntu repositories has jumped to 3.7. Hooray! Go ahead and install Eclipse

    ~$ sudo apt-get install eclipse

  7. Download and install the Android SDK
  8. Following the instructions here, which include a download link, install the SDK. You can download it with this command

    ~$ wget http://dl.google.com/android/android-sdk_r16-linux.tgz

    Next, untar the package

    ~$ tar -xvzf android-sdk_r16-linux.tgz

    You will need to remember where these files ended up when you install the ADT plugin for Eclipse. If you followed these instructions, you should have extracted the files to ./android-sdk-linux/

  9. Install the ADT Plugin in Eclipse
  10. The next next step historically posed me the most problems. This time proved no different. Rather than plagiarize the steps, just look here for the instructions. To summarize the steps, you must open Eclipse, add the ADT plugin location, and install the ADT plugin within Eclipse. Once installed, you must point Eclipse to the location of the Android SDK folder, previously installed.

    If you get the following error during the install

    Cannot complete the install because one or more required items could not be found. Software being installed: Android Development Tools 16.0.1.v201112150204-238534 (com.android.ide.eclipse.adt.feature.group 16.0.1.v201112150204-238534) Missing requirement: Android Development Tools 16.0.1.v201112150204-238534 (com.android.ide.eclipse.adt.feature.group 16.0.1.v201112150204-238534) requires 'org.eclipse.wst.sse.core 0.0.0' but it could not be found

    then try running Eclipse as root.

    ~$ sudo eclipse

    and try again. This did the trick for me. It seems to be a problem on 64 bit Ubuntu with Eclipse v3.7


  11. Install Additional Android Developer Components
  12. Now, in a terminal, and go to the android-sdk-linux_x86/tools/ directory and run the Android program to open the Android SDK and AVD manager.

    ~$ cd ~/android-sdk-linux/tools/
    ~/android-sdk-linux/tools$ ./android

    You should get a window like this

    Select 'Available packages' on the left. Next, select the components that you want. Google provided a list of suggested components here. Once you have selected the packages that you want, click the 'Install selected' button on the bottom right. Depending on what you select, it may need to download several hundred mb. This can take awhile. You can find more information on using the SDK and AVD manager here.

  13. Setting up your PATH variable (Optional)
  14. In Ubuntu, you want to open your .bashrc file. A simple

    ~$ gedit ~/.bashrc

    will open the file. Next, add the following line to the end of .bashrc

    export PATH=${PATH}:(path-to-sdk)/android-sdk-linux/tools:(path-to-sdk)/android-sdk-linux/platform-tools

    replacing (path-to-sdk) with the path to where you installed the sdk. If you followed this tutorial, it will probably be in your home directory.

  15. Creating an AVD
  16. If you've made it this far, before you dive into your 'Hello World' application, you need to create an AVD, or Android Virtual Device.

    First, if you haven't already installed a platform in Step 5. Once you have a platform installed, follow the instructions here

  17. Start Programming!
  18. If all went well, you are ready to start developing an app for Android!


Some Notes

The official Android SDK instructions say you might have to fiddle with the USB settings to get your physical hardware to play nicely with the debugger. All I had to do was to enable USB Debugging under application settings on the Android device and I was on my way. That was a nice surprise.

This time around, installing the SDK went smoothly. I think the SDK and Ubuntu showed some maturity in the ease of installing the SDK. Last year I had to fight a little with things just to get anything to work.


Was this helpful?

Did this work for you? Were you able to install the SDK fine on your machine? What problems did you have?

Let me know by leaving a comment!

3 comments:

  1. Hi there,
    I could not find any e-mail addr to send to, so I hope you get this and perhaps able to help me.
    I have installed ubuntu 11.10 on a Ora.VBox. I tried to install JDK with the command above but it complained "unable to locate package openjdk".
    Thx&Rgds,
    Shah

    ReplyDelete
    Replies
    1. Is that the exact error message? If so, you have to select a version of the open jdk, such as

      openjdk-6-jdk

      or

      openjdk-7-jdk

      If those don't help you, make sure you run a

      sudo apt-get update && sudo apt-get upgrade

      and watch for repo's that fail.

      Delete
  2. Thanks for your informative article. Android SDK allows you to create stunning mobile application loaded with more features and enhanced priority. With basis on Java coding language, you can create stunning mobile application with ease. Best Android Training in Chennai

    ReplyDelete

Youtube Channel

Loading...