Android SDK In Eclipse Installation :Linux

Android SDK In Eclipse Installation :Linux
The Android SDK is a development kit created by Google for developing on the Android platform. Google also released an Eclipse plugin that allows for Android SDK integration in the Eclipse IDE. Also an emulator is included to ease development and debugging. The development kit is modular allowing for only certain components or Android SDK versions to be installed.

Downloading and installing the Android SDK
Download the Android SDK from Google Uncompress the downloaded archive and copy the package to a suitable location. Take note of this location you'll need to put it into the Eclipse plugin later.
$ tar -zxvf android-sdk_r3-linux.tgz
# cp -a android-sdk-linux /usr/local

Installing the Eclipse plugin
Open Eclipse and go to Help > Install New Software. Then click add button to add a new site.

Give the new site a descriptive name such as Google Android Dev and use eclipse update site to install the Android ADT eclipse plugin. Click ok and eclipse will download the information about available packages from the new site. 

Check developer tools and click next. 

Click next again confirming the list to install including any dependancies. Accept the license agreement and click finish. Eclipse will download and install the plugins. Accept any warnings about an unsigned application being installed. Finally Restart Eclipse when prompted

Configure The Android Eclipse Plugin

Go to Window > Preferences and open the android preferences. Set the location of the Android SDK to where you installed it earlier. Now it's time to install the plugin packages.

Install SDK Packages

Once the SDK has been installed there are associated packages that need to be downloaded through the SDK. Go to Window > Android AVD and SDK Manager. Notice the phone icon next to the option. That also appears in the toolbar as a shortcut to the Android AVD & SDK manager.

Click available packages in the left pane and expand the predefined Google source. Select the SDK platforms and APIs for the desired platforms and click install selected. It's probably best just to install all the packages as applications should be tested on multiple platforms and Android revisions. Accept the license agreement and click install. This is a lot of data so expect it to take a while depending on your internet speed. Finally restart adb when prompted. The packages should now be listed under the installed packages pane. 

Building an emulator

In the Android SDK and AVD Manager click virtual devices in the left pane and click new. Give the Emulator a familiar name. Next select the proper target android level. This is the version of Android the emulator will run. Then enter the size of the virtual SD Card to be created for the emulator. There are also a number of device functionality emulators included that can be added. These provide mock versions of the camera, gps, etc to be developed against. Finally Click create AVD. Once the AVD has been created a dialog box will inform you.

Attaching a physical device

Physical devices can also be used to develop applications against. They are faster and less resource intensive than running the emulator. Once a device has been properly configured and is attached to the system they will appear in the Android SDK and AVD Manager. In Linux udev must be setup for the phone to be properly detected.

Android Device udev Rules

This is a simple addition to /etc/udev/rules.d. Create a new file /etc/udev/rules.d/51-android.rules containing one of the following lines. The SYSFS{idVentor}== value needs to be adjusted to the correct USB ID for your device. Depending on your linux distro one of the following 2 lines:
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="22b8", MODE="0666"


SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"

Android USB Device Chart

HTC - 0bb4
Motorola - 22b8
Samsung - 04e8
Acer - 0502
Sony Ericsson - 0fce

No comments: