Setting Up Ubuntu For Android Development, 2015 Edition

At work I use a MacBook Pro because that’s what they give us. At home, my desktop is Windows because of Windows Media Center and gaming, but I also recently rescued a Dell laptop that now has Ubuntu on it. While setting up that laptop for Android development, I ran into a couple of gotchas and found some shortcuts; so when I set up a new VM for a new project on my desktop, I decided to document the steps for reference.

To wit, at the end of the following procedure, we’ll have Android Studio running on Ubuntu 14.04.3 (Tired Trampoline) on VirtualBox 5.0.10. If you need a lighter VM, these instructions also work with Lubuntu.

  1. Download VirtualBox (for this guide, 5.0.10), if you don’t have it
  2. Set up a new VM
  3. Download the Ubuntu Desktop ISO (for this guide, 14.04.03)
  4. Load it into the VM’s optical drive, boot up the VM, and start the install
  5. After answering the setup questions in the beginning, go watch TV for a while
  6. When it’s done, eject the install ISO from the VM and reboot
  7. It’ll boot up in glorious 640×480 mode; insert the Guest Additions CD image, to do stuff like allow you to use a decent desktop resolution:
    VirtualBox Guest additions disc

    • A dialog will come up allowing you to automatically run the script on the disk, but if something goes awry, open a terminal, go to the disk and manually run the script:
      cd /media/{username}/VBOXADDITIONS*
      sudo ./VBoxLinuxAdditions.run
      
  8. Reboot the VM
  9. Change the display resolution to something sane (System Settings -> Displays)
  10. If the Unity side taskbar annoys you too, make it auto-hide (System Settings -> Appearance -> Behavior; enable workspaces too) and install Cairo dock:
    sudo apt-get install cairo-dock
  11. Install Oracle the Java 8 JDK — not OpenJDK, because AndroidStudio doesn’t like that as much. You can do this easily thanks to the WebUpd8 team:
    sudo apt-add-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
  12. If you’re running 64-bit Ubuntu, you’ll need to install a couple of 32-bit libraries the Android SDK needs to avoid the Unable to run mksdcard SDK tool” error:
    sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
  13. Install Android Studio from Paolo Ratolo’s repo:
    sudo apt-add-repository ppa:paolorotolo/android-studio 
    sudo apt-get update 
    sudo apt-get install android-studio
  14. Run Android Studio and add it to the launcher:
    /opt/android-studio/bin/studio.sh
  15. If you need to, install git
    sudo apt-get install git