* as an alternative, you can install the ADT via eclipse's built in "add new software" command (see instructions on ADT site).

+

* if you are in real trouble, it is also possible to download Android SDK and use the bundled Eclipse. This usually works without problems.}}

Enter the path to the Android SDK Location in

Enter the path to the Android SDK Location in

Windows -> Preferences -> Android

Windows -> Preferences -> Android

−

−

{{Note|as an alternative, you can install the ADT via eclipse's built in "add new software" command. This has the advantage of keeping the ADT always up to date, unlike the AUR approach which requires manually updating packages. You may need to add the eclipse update site so that ADT can pull dependencies from it: http://download.eclipse.org/releases/juno/}}

−

−

{{Note|if you are in trouble, it is also possible to download Android SDK and use the enclosed Eclipse. This should works without problems.}}

When using Eclipse as an IDE you need to install the ADT plugin and related packages. If you get a message about unresolvable dependencies, install Java manually and try again. Alternatively you can use Netbeans for development after installing living and usually up to date plugin according to these instructions.

Setting up Eclipse

Most stuff required for Android development in Eclipse is already packaged in AUR:

Then go to Available Plugins and install the Android and Android Test Runner plugins for your IDE version. Once you have installed go to:

if you have problem with netbeans 7.2 "org.netbeans.modules.gsf.testrunner was needed and not found." Please remove the the Android and Android Test Runner , then change the url of nbandroid to: http://nbandroid.org/release72/updates/updates.xml , update the sources and you just need to install the Android only.

Tools -> Options -> Miscellaneous -> Android

and select the path where the SDK is installed. That's it, now you can create a new Android project and start developing using Netbeans.

Android platforms

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

Automatic installation

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

android

or alternatively:

./<path_to_android-sdk>/tools/android

If the automatic installation errors out, then you must either run the android tool with heightened privileges or set your user account as the owner of the directory. To change the owner ID for all SDK directories, run the following command as root:

chown -R USER /opt/android-sdk

To change the group ID instead (recommended for multiple users), first create the group, perhaps called android, and add your user account to it:

Manual installation

Download the platform you want to develop on. This site provides online links to several Android SDK components.

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.

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.

Using existing rules

Install the AUR package android-udevAUR to get a common list of vendor IDs. If ADB recognizes your device (it is visible and accessible in IDE), you are done. Otherwise see instructions below.

Figure Out Your Device Ids

Each Android device has a USB vendor/product ID. An example for HTC Evo is:

vendor id: 0bb4
product id: 0c8d

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 rules from Android developer or you can use the following template for your udev rules, just replace [VENDOR ID] and [PRODUCT ID] with yours. Copy these rules into /etc/udev/rules.d/51-android.rules:

Note: reloading udev rules under systemd should not be required, as any rule changes should be picked up automatically.

Does It Work?

After you have setup the udev rules, unplug your device and replug it.

After running:

$ adb devices

you should see something like:

List of devices attached
HT07VHL00676 device

If you do not have the adb program (usually available in /opt/android-sdk/platform-tools/), it means you have not installed the platform tools.

If you are getting an empty list (your device isn't there), it may be because you have not enabled USB debugging on your device. You can do that by going to Settings => Applications => Development and enabling USB debugging.

Tip: Make sure that your user is added to the group:

# gpasswd -a username adbusers

If there are still problems such as adb displaying "???????? no permissions" under devices, try restarting the adb server as root.

If you run lunch without arguments, it will ask what build you want to create. Use -j with a number between the number of cores and 2 * number of cores.

The build takes a lot of time.

When finished, run the final image.

$ emulator

Tips & Tricks

During Debugging "Source not found"

Most probably the debugger wants to step into the Java code. As the source 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:

Linux distribution on the sdcard

You can install Debian like in this thread. Excellent guide to installing Arch in chroot (in parallel with Android) can be found on archlinuxarm.org forum.

Android SDK on Arch 64

When using the Android SDK and the Eclipse plugin on a 64 bit system, and the 'emulator' always crashes with a segfault, do the following:
Provide a localtime file in /usr/share/zoneinfo/localtime e.g.:

# cp /usr/share/zoneinfo/Europe/Berlin /usr/share/zoneinfo/localtime

Better MTPFS Support

If you have an Android device that doesn't support UMS and you find mtpfs to be extremely slow you can install jmtpfsAUR from the AUR.