Arch Linux

Android development environment

Using Arch Linux 64 bit, and IntelliJ IDEA as Eclipse is bleergh.

Download the Android SDK, uncompress it to ~/Applications/android-sdk

Install JRE+JDK, the OpenJDK flavour, as Oracle doesn't want people to distribute the JDK anymore :-P


pacman -S openjdk6

Two notes:

  • OpenJDK is not a supported environment for IntelliJ but it seems to work OK for me--you'll get an error message if launching IDEA from the command line, but you can somehow safely ignore it
  • I first tried to install jdk7 but the Android SDK requires version 6 (i.e. Java 1.6), so I had to "downgrade"

For the SDK to work we need to install multilibs plus some 32 bit libraries, as the SDK is distributed in 32 bit form only. You might be asked to replace some earlier native 64 bit builds with the multilib flavour, say YES as the multilib can deal with 32 and 64 bit stuff indistinctly:

First edit /etc/pacman.conf and uncomment the multilib lines. They should look like this:


[multilib]
Include = /etc/pacman.d/mirrorlist

Then install the new stuff:


pacman -Sy
pacman -S gcc-multilib gcc-libs-multilib binutils-multilib libtool-multilib lib32-glibc lib32-ncurses lib32-zlib

Cd to the SDK directory/tools and invoke the android exe so that you can choose which platforms and additional things you'll be targetting:


cd ~/Applications/android-sdk/tools
./android

You might also want to add the tools and platform-tools directory to your PATH, editing ~/.bashrc and adding this line:


PATH=$PATH:/home/sole/Applications/android-sdk/platform-tools:/home/sole/Applications/android-sdk/tools

My IntelliJ IDEA launcher, place it in ~/Applications/intellij.sh:


#!/bin/bash

export JAVA_HOME="/usr/lib/jvm/java-6-openjdk/"
/home/sole/Applications/intellij/bin/idea.sh

And the .desktop application launcher. Place it in ~/.local/share/applications/intellij.desktop. The menu should display the new entry automatically:


[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/home/sole/Applications/intellij.sh
Icon=/home/sole/Applications/intellij/bin/idea_CE128.png
Name=IntelliJ Idea
Comment=Yay
Categories=Development

To deploy to and debug physical devices you need to edit the /etc/udev/rules.d/51-android.rules file. These are the contents for using a Google Nexus One phone:


SUBSYSTEM=="usb", SYSFS{idVendor}=="18D1", MODE="0666"

And make it readable


chmod a+r /etc/udev/rules.d/51-android.rules

There's also an Android page in the excellent Arch Wiki.