Android SDK Linux quick setup

Android SDK setup for Linux is a bit different than in Windows. I wrote quick instructions to setup Android development environment in Linux:

1. Setup Java dev environment:

First you need to install JDK and Eclipse

sudo apt-get install sun-java6-jdk eclipse

2. Install Android SDK starter package

sudo wget http://dl.google.com/android/android-sdk_r11-linux_x86.tgz

sudo tar -zxf android-sdk_r11-linux_x86.tgz

(Or download and extract manually from http://developer.android.com/sdk/index.html)

3. Install & configure ADT plugin for Eclipse

  • Open Eclipse and select from menu Help -> Install New Software
  • Add software source by clicking Add and give some name to repository and the following address: ¬†https://dl-ssl.google.com/android/eclipse/
  • Select all tools and click next, next and accept the agreement and click finish
  • Restart Eclipse
  • After restart select¬†Window -> Preferences… from Eclipse’s menu
  • Select Android from the left pane and set the Android SDK location to correspond with the directory where you extracted the started package in step 2

4. Install Android platforms and other components

Now you can download and install different Android platforms and create virtual images with SDK and AVD manager straight from Eclipse. (…or with android tool which is located in the sdk directory)

  • In Eclipse select Window -> Android SDK and AVD manager
  • From the left pane select Available packages and download & install the packages you want (Select 3rd party add-ons and Google APIs if you want to use e.g. Google Maps)
  • Platform tools will be downloaded to you SDK directory

5. Create test project and virtual images

Virtual images can be created with the Android SDK and AVD manager. Create and start one.

Now create new Android project:

  • Select File -> New Project -> Project...
  • Select Android -> Android project
  • Type in Project name, Package name and check build target from the list of downloaded & installed platforms. Click Finish
  • Run the project with Ctrl+F11, select Run as Android Application
  • Select a virtual image in where you want to run the application (or create one if you haven’t already)

6. Running applications in hardware devices

In Linux you have to manually add USB support for different device manufacturers.

Create and edit following file
sudo nano /etc/udev/rules.d/51-android.rules

Insert following text to the file:
SUBSYSTEM=="usb", SYSFS{idVendor}=="XXXX", MODE="0666"
where XXXX is the device manufacturers vendor ID. IDs are presented in the table below

Company USB Vendor ID
Acer 0502
Dell 413c
Foxconn 0489
Garmin-Asus 091E
Google 18d1
HTC 0bb4
Huawei 12d1
Kyocera 0482
LG 1004
Motorola 22b8
Nvidia 0955
Pantech 10A9
Samsung 04e8
Sharp 04dd
Sony Ericsson 0fce
ZTE 19D2

Set the permissions for the file:
chmod a+r /etc/udev/rules.d/51-android.rules

Now attach the device with usb cable and it should be recognized in the Run dialog.

PS. make sure you have turned the USB debugging on in the device (e.g. Settings -> Applications -> Development enable USB debugging)

Share and Enjoy:
  • Facebook
  • del.icio.us
  • MySpace
  • RSS
  • LinkedIn
  • PDF
  • Print

Tags: , , , , ,

Leave a Reply

You must be logged in to post a comment.