Skip to content

Android build environment

rinigus edited this page Nov 2, 2025 · 1 revision

You could build Android or Sailfish HADK bits on your Linux PC directly. Alternative is to use an environment that has all packages installed for a build. This document describes such alternative procedure.

Environment variables

Below, few environment variables that are defined for simplicity:

export DEVICE=xqct54
export HABUILD_DEVICE=pdx223

export VENDOR=sony
export FAMILY=nagara
export ANDROID_VERSION_MAJOR=14
export HAVERSION=lineage-21.0

export ANDROID_ROOT="$HOME/nagara/hadk"

Setting up an Android Build Environment using Podman/Docker

To build the environment, you can use Podman and docker configuration in https://github.com/sailfishos-sony-nagara/main repository.

To use Podman with the included Dockerfile, proceed as follows:

  • change to android-build subfolder of main repository
  • rename .gitconfig.template to .gitconfig and fill-in information
  • build the image: podman build --no-cache -t android-env .

After that, you can enter the environment with

podman run --rm -it -v `pwd`:/android android-env:latest

inside your $ANDROID_ROOT folder. If using this environment, $ANDROID_ROOT will be set to /android. To pass HADK related environment variables to podman, write a script or run something like

podman run --rm -it \
  -v $ANDROID_ROOT:/android \
  -v $ANDROID_ROOT-userconfig:/root \
  -v $ANDROID_ROOT_REPO/.repo:/android/.repo \
  -e DEVICE=$DEVICE -e HABUILD_DEVICE=$HABUILD_DEVICE \
  -e VENDOR=$VENDOR \
  -e FAMILY=$FAMILY \
  -e ANDROID_VERSION_MAJOR=$ANDROID_VERSION_MAJOR \
  -e HAVERSION=$HAVERSION \
  -e PORT_ARCH=$PORT_ARCH \
  -e SAILFISH_BUILD=1 \
  android-env:latest

Above, folder $ANDROID_ROOT-userconfig should be available and it would keep your last command history. Its also a folder that would have to have then your .gitconfig.

Clone this wiki locally