Project

General

Profile

DeprecatedReplicant42ADTBuild » History » Revision 6

Revision 5 (Beuc Beuc, 07/26/2015 11:25 AM) → Revision 6/11 (Beuc Beuc, 07/26/2015 01:41 PM)

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

h2. Principle of operation

The [[ReplicantSourceCode|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":http://android-developers.blogspot.fr/2015/06/an-update-on-eclipse-android-developer.html in favor of Android Studio, based on IntelliJ.

h2. 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:
* [[BuildEnvironments#Trisquel-41-Taranis-based-on-Ubuntu-1004-Lucid-with-LXC|Trisquel 4.1 Taranis (based on Ubuntu 10.04) [[BuildEnvironments#Ubuntu-1004-Lucid-with-LXC|Ubuntu 10.04 Lucid with LXC]] (see below for Trisquel-specific build error)
* [[BuildEnvironments#Non-privileged-user-setup|Non-privileged user setup]]

h2. Build dependencies

<pre>
# Based on https://web.archive.org/web/20121201011547/http://source.android.com/source/initializing.html
# git recompiled manually, mingw32 dropped
apt-get install 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
</pre>

h2. Preparing the sources

Based on [[ReplicantSourceCode]] with additional configuration.
Login as user @replicant@ and:

<pre>
mkdir ~/tools/
cd ~/tools/
wget http://commondatastorage.googleapis.com/git-repo-downloads/repo
chmod a+x repo
cd ~

cat <<EOF >> ~/.bashrc
export USE_CCACHE=1
EOF
exec bash

# Avoid prompts
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git config --global color.ui true

mkdir replicant-4.2/
cd replicant-4.2/
../tools/repo init -u git://git.replicant.us/manifest.git -b replicant-4.2
../tools/repo sync -j4
# > 1h, 27GB (inc. 17GB .repo)
</pre>

h2. Building ADT 21

<pre>
. build/envsetup.sh
cd sdk/eclipse/

# Complies with setup_eclipse.sh and fix download URL
sudo mkdir -p /buildbot/eclipse-android
sudo chown replicant /buildbot/eclipse-android
sed -i -e '/eclipse-rcp-helios-SR2/ s/download.eclipse.org/archive.eclipse.org/' \
scripts/setup_eclipse.sh
# 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/build_server.sh ~/adt
# 15mn with 4 cores, 32GB (inc. 17GB .repo) .repo), 1GB .ccache
</pre>

The ADK release is in @~/adt/android-eclipse-v201507252158.zip@ :)

h2. Testing

See the nice Eclipse tutorial at [[SDK#Usage-guides]].

h2. TODOs

* warning on installation, maybe we can sign the package:
<pre>
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?
</pre>

* Note: error in Eclipse 3.8.1 in the layout edition view. Needs testing with an older Eclipse:
<pre>
This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in
</pre>

* Do we rely on prebuilt/prebuilts dirs?

* Error with Trisquel 4.1, but not with Ubuntu 10.04. No idea where that comes from, it's supposed to be the same environment :/

<pre>
# Trying with Trisquel 4.1:
Output: /home/replicant/replicant-4.2/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar
Input : /home/replicant/replicant-4.2/out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar
Input : /home/replicant/replicant-4.2/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at com.android.tools.layoutlib.create.Main.createLayoutLib(Main.java:89)
at com.android.tools.layoutlib.create.Main.main(Main.java:75)
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
... 2 more
make: *** [/home/replicant/replicant-4.2/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar] Error 1
</pre>