2011-05-18

Android Development Tools 11

Update: Get the official release candidate build of ADT 11 if you’re feeling lazy.

The Android Development Tools session at Google I/O introduced several new fancy features in the ADT, and you can build the development tools yourself to keep up with the latest changes between releases.

The following is more or less a condensed version of the official instructions for building the SDK and the Eclipse plugins, with some minor changes.

First of all you need to set up your local environment and download the source tree according to the Android Open Source Project documentation (omit the -b when doing repo init to get the master branch).

Configure and compile the SDK

 $ . build/envsetup.sh
 $ lunch sdk-eng
 $ make sdk
 $ ./sdk/eclipse/scripts/create_all_symlinks.sh

Import the following projects into Eclipse (Right click in the Workspace and choose “Import…”, then select “Existing Projects into Workspace”)

  • sdk/eclipse/plugins/com.android.ide.eclipse.adt
  • sdk/eclipse/plugins/com.android.ide.eclipse.ddms
  • sdk/common
  • sdk/ddms (import all 3 projects - ddmlib, ddms-plugin, ddmuilib)
  • sdk/ide\_common
  • sdk/androidprefs
  • sdk/sdkstats
  • sdk/layoutlib\_api

Add ANDROID_SRC as a classpath variable pointing to Android root (where you checked out the source code with repo), ANDROID_OUT_FRAMEWORK to ANDROID_SRC/out/host/linux-x86/framework.

Open the Preferences dialog and go to Java->User Libraries, then add ANDROID_JFREECHART (add the three jars under prebuilt/common/jfreechart) and ANDROID_SWT (add the three jars under prebuilt/common/eclipse, as well as swt.jar from prebuilt/[platform]-[arch]/swt).

When all paths have been configured, create a run configuration for the adt project and start it to get a new Eclipse instance with the newly-built tools.

If you get a java.lang.OutOfMemoryError: PermGen space error when running the ADT, increase the PermGen size by adding something like -XX:PermSize=512M -XX:MaxPermSize=1024M (change depending on available memory) to the run configuration in Eclipse.

Tip: If you have a custom view that depends on external data that is not available at design time, use isInEditMode() to add dummy data so that the view will render correctly in the visual layout editor.