This is a note for building the anbox Android image on my Arch Linux laptop.
This closely follows the official guide.
Following the wiki: https://wiki.archlinux.org/index.php/Android#Building
I use yay
for AUR packages as an example:
$ yay -Syu aosp-devel
The AOSP source is huge (over 100GB), so downloading can take a day or so.
It's possible to use a different AOSP source mirror, just modify the manifest xml,
change fetch
property of the aosp
remote. If you followed the official guide, the manifest
will be in the hidden .repo
directory.
As noted in the official guide, run the following commands before making:
$ . build/envsetup.sh
$ lunch anbox_x86_64-userdebug
You should temporarily change your default JDK to OpenJDK 8:
# archlinux-java set java-8-openjdk
To make those Python 2 build scripts work, we want to make
$ /usr/bin/env python
resolves to the Python 2 interpreter.
We can create a dummy path directory to achieve this.
$ cd ~
$ mkdir py2env
$ ln -s /usr/bin/python2 py2env/python
Then prepend your py2env
to PATH
.
Additionally we need to set LC_ALL=C
to mitigate a known bug:
So the final make
command:
$ PATH=~/py2env:$PATH LC_ALL=C make -j8
After a long build time, follow the guide to create the image (assuming workspace is at $HOME/anbox-work
):
$ cd $HOME/anbox-work/vendor/anbox
$ ./scripts/create-package.sh \
$PWD/../../out/target/product/x86_64/ramdisk.img \
$PWD/../../out/target/product/x86_64/system.img
Note the official guide misses one ../
.