Build the Android Development Tools for Eclipse (ADT) with Replicant 4.2

See feature #657 for the discussion about a ADT for Replicant and this page.

Principle of operation

The Android 4.2 source code ships a sdk/eclipse/ directory with ADT build scripts.
The build script will also download Eclipse 3.6.2 files as build dependencies.

Note: as of 2015-07, ADT is deprecated in favor of Android Studio, based on IntelliJ.

Recreate matching build environment

Replicant 4.2 is based on CyanogenMod 10.1 which is based on AOSP 4.2.2, released 2013-02.
The build environment used by NDK release managers should be Ubuntu LTS 10.04.

To recreate it easily with LXC, follow:

Build dependencies

# Based on
# git recompiled manually, mingw32 dropped
apt-get install wget gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
  x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
  libgl1-mesa-dev g++-multilib python-markdown \
  libxml2-utils xsltproc
apt-get install openjdk-6-jdk libasm-java

Preparing the sources

Login as user replicant and prepare the Replicant 4.2 source code as described in ReplicantSourceCode.

Building ADT 21

. build/
cd sdk/eclipse/

# Complies with and fix download URL
sudo mkdir -p /buildbot/eclipse-android
sudo chown replicant /buildbot/eclipse-android
sed -i -e '/eclipse-rcp-helios-SR2/ s/' \
# Note: I tried with 'apt-get install eclipse-rcp eclipse-pde' and ECLIPSE_HOME=/usr/lib/eclipse
# but it lacks org.eclipse.wst.* plugins aka eclipse-wtp-xmltools

mkdir ~/adt/
scripts/ ~/adt
# 15mn with 4 cores, 32GB (inc. 17GB .repo)

The ADK release is in ~/adt/ :)

Signing ADT

By default, Eclipse display on install:

Warning: You are installing software that contains unsigned content.
The authenticity or validity of this software cannot be established. Do
you want to continue with the installation?

Let's sign the package.
Make sure you have keytool (openjdk-6-jre-headless) and jarsigner (openjdk-6-jdk), and:

# generate self-signed certificate
keytool -genkey -dname 'cn=Builder,ou=ADT,o=Replicant,c=FR' -keystore ~/adt/cacerts -validity 3650 -storepass 'changeme' -keypass 'changeme' -alias 'replicant'
# sign the JARs and repack
unzip -d t/
find t/features/ t/plugins/ -name "*.jar" -exec jarsigner -keystore ~/adt/cacerts -storepass 'changeme' -verbose {} 'replicant' \;
(cd t/ && zip -r ../ *)
rm -rf t/

At install time, Eclipse will ask the user if she trusts "Builder; ADT; Replicant".


See the nice Eclipse tutorial at SDK.


  • Note: partial incompatibility in Eclipse 3.8.1, in the layout edition view. Needs testing with an older Eclipse:
    This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in

    ADT 21 should work with 3.6.2 (used for compilation) and possibly with 3.7 (to be tested).
  • Do we rely on prebuilt/prebuilts dirs?

Updated by Wolfgang Wiedmeyer about 7 years ago · 11 revisions

Also available in: PDF HTML TXT