From ArchWiki
Revision as of 15:35, 13 June 2011 by Sandstorm (talk | contribs)
Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Android Development on Arch

Android SDK Installation

To install the android-sdk, simply install it from the AUR android-sdk. When using Eclipse as an IDE. you need to install the ADT plugin and related packages.

Install the following first:

pacman -S eclipse-emf eclipse-gef

All packages are available for installation through AUR:

  1. AUR eclipse-wtp-wst
  2. AUR eclipse-android (this is the Eclipse ADT)
  3. AUR android-sdk
  4. AUR android-sdk-platform-tools

Enter the path to the Android SDK Location in Eclipse -> Windows -> Preferences -> Android


Android Debug Bridge (ADB) - Connecting to a real device

To get ADB to connect to a real device or phone under Arch, you must install the udev rules to connect the device to the proper /dev/ entries. This can be done manually, or you can use the AUR package udev-android-rules to use a common list of vendor ids.

Each Android device has a usb vendor id and a usb product id. For example, my HTC EVO has:

vendor id: 0bb4
product id: 0c8d

Figure Out Your Device Ids

Plug in your device and execute

# lsusb

It should come up something like this:

Bus 002 Device 006: ID 0bb4:0c8d High Tech Computer Corp.

Adding udev Rules

Use the following udev rules as a template, and replace [VENDOR ID] and [PRODUCT ID] with yours. Copy these rules into /etc/udev/rules.d/90-android.rules

SUBSYSTEM=="usb", SYSFS{idVendor}=="[VENDOR ID]", MODE="0666"
SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_adb"
SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_fastboot"

Then, to reload your new udev rules, execute:

# udevadm control --reload-rules

Does It Work?

After this, unplug your device and replug it. You should see something like:

List of devices attached 
HT07VHL00676    device

The following command will fail because you have not yet installed the platform tools (see below):

$ adb devices

Android platforms

Before developing android applications, you need to install at least one android platform, which can be done either automatically or manually.

An AUR package exists to install the basic SDK platform: android-sdk-platform-tools

Automatic installation is done via the Android SDK and device manager, which is accessible by invoking (assuming that the $PATH variable contains the path to the android sdk tools directory)


or alternatively,

Note: the default installation directory in Arch is /opt/android-sdk/

For step by step automatic installation, see Installing SDK Components.

For manual installation:

  1. Download the platform you want to develop on. This site provides online links to several Android SDK components.
  2. Extract the tarball to /<path_to_android-sdk>/platforms.

Now, you should see the platform of your choice installed in the Installed Packages window of the Android SDK and device manager.


See Android_Tethering


During Debugging "Source not found"

Most probably the debugger wants to step into the java code. As the soruce code of Android does not come with the Android SDK, this leads to an error. The best solution is to use step filters to not jump into the java source code. Step filters are not activated by default. To activate them:

Window -> Preferences -> Java -> Debug -> Step Filtering

Consider to select them all. If appropriate you can add the android.* package. See the forum post for more information:

Linux distro on the sdcard

You can install Debian like in this thread, or you can adapt it to install archlinux. You should replace all debootstrap stuff by

mkdir -p /data/local/mnt/var/{cache/pacman/pkg,lib/pacman}
pacman --root /data/local/mnt --cachedir /data/local/mnt/var/cache/pacman/pkg -Sy base