Installing the Android SDK on Linux

Dec 23, 2012 Android System

This is a quick guide to installing the Google Android SDK on Gentoo Linux. Most steps explained here also apply to other variations of Linux as well.

The Google Android SDK can be downloaded for free off the Android Developers website, and at the time of writing 1.6 SDK Release 1 had just been released as weighs in at around 230MB’s compressed.

Set your PC up with Android SDK

  • Ensure you have the Android SDK downloaded, and the included USB driver installed correctly on your desktop. It is very important on Linux that your USB device gets 666 permissions else the SDK tools will not be able to “talk” to the device.
    On Gentoo I needed to add to /etc/udev/rules.d/51-android.rules:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

For Gusty/Hardy, edit the file to read:

SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

For Dapper, edit the file to read:

SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"
  • If you are using a 64bit Operating System like I am, you will need to install a 32bit Java. I had to install emul-linux-x86-java on Gentoo.
  • In order to use the SDK tools the SDK’s tools directory needs to be in your path. On the console type:
export PATH="/path_to_the_android_sdk/tools/:$PATH"

On a 64bit OS, you’ll need to also add the 32bit java path too else the chances are your system will try run the files with the wrong java and the software will not work:

export PATH="/opt/emul-linux-x86-java-1.6.0.15/bin/:/path_to_the_android_sdk/tools/:$PATH"
  • On your phone, make sure you turn ON USB debugging. Go to Settings -> Applications -> Development -> USB debugging and make sure you have ticked the box. Connect your phone to your PC (no need to mount the sdcard), and after a few seconds when your USB devices settle, type adb devices:
adb devices
List of devices attached
HT95SKF07631     device

If you do not get a device under the list of devices then you will need to check your USB permissions. If you do get something like what you see above, it means your SDK is running correctly and can see your phone.

Take a Screenshot

Taking a screenshot with Google Android unfortunately has to go through the SDK and cannot (yet?) be done on the phone itself. Once you have the SDK installed and working however, it is very easy. The main things to make sure is if your SDK tools directory is in your $PATH, and whether your USB permissions are correct.

Type ddms which will start up the Android debugging tool. You should see your device in the top left section, select it and from the menus on top you can take a screenshot.

Comments