Wednesday, November 30, 2011

Building the ADT Plugin for Eclipse

ADT Plugin Revisions

Notes about successive releases of the ADT Plugin can be found at
Currently the last revision is ADT 15.0.1 (November 2011)
Usually ADT Plugin has dependencies with SDK Tools (located at <sdk>/tools directory of sdk). So do not forget to check the dependency and update to corresponding SDK Tools version after updating ADT Plugin.

Getting the ADT Plugin Sources

You can follow instructions from

In total you should perform the following sequence of commands:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl --insecure --proxy krsuls001:8080 > ~/bin/repo
$ chmod a+x ~/bin/repo
$ repo init -u -b android-4.0.1_r1
$ repo sync sdk

After this sdk project will be downloaded to your WORKING_DIRECTORY. You can list all available branches:

$ git branch –a

and also switch to version you need, for example ADT 15.0.1:

$ git checkout remotes/aosp/tools_r15

android-2.3.7_r1 sources contain ADT 0.9.9 release
android-4.0.1_r1 sources contain ADT 14.0.0 release

Buiding the ADT Plugin from Android Source Tree under Linux

First of all you should get the whole Android Source Tree (see details at
Then you should get Eclipse RCP (
Build Plugin:
  • WORKING_DIRECTORY – directory with Android Source Tree
  • eclipse_plugin – destination directory for plugin
$ . build/
$ lunch sdk-eng
$ export ECLIPSE_HOME=~/eclipse
$ ./sdk/eclipse/scripts/ ~/eclipse_plugin/

In case of successful build you get the something like in eclipse_plugin directory.

Building the ADT Plugin with Eclipse under Windows

First of all get the sdk source code necessary version. You will also need some libraries from android/prebuilt.
Then check that you have "Eclipse Plug-in Development Environment" installed in Eclipse.
In Eclipse right click in the Workspace and choose "Import...", then select "Existing Projects into Workspace". You need to import the following projects:
  • sdk\eclipse\plugins\
  • sdk\eclipse\plugins\
  • sdk\eclipse\plugins\
  • sdk\eclipse\plugins\
  • sdk\eclipse\plugins\
  • sdk\eclipse\features\
  • sdk\eclipse\features\
  • sdk\eclipse\features\
  • sdk\eclipse\features\
  • sdk\eclipse\sites\external
  • sdk\androidprefs
  • sdk\assetstudio
  • sdk\common
  • sdk\ddms (import all 3 projects - ddmlib, ddms-plugin, ddmuilib)
  • sdk\hierarchyviewer2 (import app, hierarchyviewerlib)
  • sdk\ide_common
  • sdk\layoutlib_api
  • sdk\rule_api
  • sdk\sdkmanager (import sdklib, sdkuilib)
  • sdk\sdkstats
  • sdk\swtmenubar
Define two User Libraries:
-    ANDROID_JFREECHART (add the 3 jars under android/prebuilt/common/jfreechart)
-    ANDROID_SWT (add the 3 jars under android/prebuilt/common/eclipse and android/prebuilt/windows/swt/swt.jar)
Some projects have ANDROID_SRC and ANDROID_OUT_FRAMEWORK Classpath Variables. Actually you could add requested jar files as “External JARs”.
To create *.jar file from sources:
-    Right click on Project
-    Select “Export”
-    Java -> JAR file, press Next
-    Select the export destination for JAR file

Note 1: You can face with the following error during modifying the project properties:

Remove the windows hidden attribute that is set on the .classpath file. This should fix the error.

Note 2: For adt-overlay project, to fix the error:
C:\workspace_tw\adt-overlay\build.xml:285: srcdir "C:\workspace_tw\adt-overlay\src" does not exist!
Just create empty folder adt-overlay/src.

Note 3: If there are compile errors such as:
The method addBooleanArg(String, boolean) of type RemoteAndroidTestRunner should be tagged with @Override since it actually overrides a superinterface method
check  the Project Properties -> Java Compiler -> Errors/Warnings settings.
You can disable project specific settings or just change setting for Annotations->”Missing @Override annotation” from error to warning.

Once you get rid of all compile errors you could either run/debug ADT in Eclipse or export plugin for installing with Eclipse Plugin Manager.

Run/debug ADT Plugin:

-    Just run adt project as "Eclipse Application"
-    Another copy of Eclipse will start were you can check you plugin functionality.

Export ADT Plugin:

-    Select external-site project
-    Open site.xml
-    Hit the “Build All” button

Add the following files and directories under external-site project directory to


Now you can use as independent plugin.

1 comment:

  1. Hi Julia,
    great post.
    I am stumbling here years later still I am posting a related question here. Hopefully, it will catch your attention.

    I am trying to build a plugin which calls the default launcher of ADT plugin but not able to achieve it till now.
    I have the ADT source. So which the main class and method which gets called by eclipse with launch configuration ? And what would be the standard launch configuration for that.