Android Marshmallow 6 Compile on Ubuntu 16.04

Short manual how to prepare Linux Ubuntu 16.04 environment to be able to compile Android Marshmallow 6


The tutorial is dedicated to Linux users

As an example The TinkerBoard Android build instruction taken from


Host Machine Hardware Configuration

100GByte free diskspace

8 or better 16 GByte of Ram

At least 4 thread CPU (performance reason)

1. Create directory for Android build purpose

mkdir tb_a6

2. Go to created folder

cd tb_a6

3. Java preparation

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
sudo apt-get update
sudo apt-get install openjdk-7-jdk
java -version

Note: The version should be as follow

java version “1.7.0_65”

OpenJDK Runtime Environment (IcedTea 2.5.3)

OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

4. Install the necessary tools to make an Android build

sudo apt-get install bison g++-multilib git gperf libxml2-utils make zlib1g-dev:i386 zip repo

5. Initialize the AOSP of Android Marshmallow tree

repo init -u -b sbc/tinkerboard/asus/Android-6.0.1

6. Download code of Android Marshmallow from Google servers

repo sync -d

7. Now before compilation a few patch of the code is necessary

7.1 When encounter problem like

libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43

then in file /art/build/ modify

# Host.


ifneq ($(WITHOUT_HOST_CLANG),true)

# By default, host builds use clang for better warnings.




# Host.


ifeq ($(WITHOUT_HOST_CLANG),false)

# By default, host builds use clang for better warnings.



and finally

cp /usr/bin/ prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld

Note 1: Above path with glibc2.11 can be different and is depend on Your local setting and files. Remember to align those cp instruction.

Note 2: If You start compilation without above change it is necessary to clean all intermediate files using

make clobber

8. When discover problem like

Try increasing heap size with java option ‘-Xmx’.

then apply following code

export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m" out/host/linux-x86/bin/jack-admin kill-server out/host/linux-x86/bin/jack-admin start-server

Note: Problem with heap usually appears when You have below 12-16 Gb of RAM in the system

9. Build AOSP images

source build/ && lunch rk3288-userdebug

10. Start compilation

make -j${nproc}

11. When finish output images are available in output folder




Michał Wołowik

Software, hardware embedded engineer. Current duties: Linux(YOCTO) and Android(AOSP) images preparation. Main duties are to develop c/c++ application.

Leave a Reply

Close Menu