>
This page describes the build process of various Android development tools. It is intended to serve as a reference to create Debian specific rules.
= Some general android build system info =
Android currently (as of 6.0) uses a GNU make based build system. The majority of it's code lives in the build repo, with per-module rules included in their specific repositories (or multiple, as we'll see later)
<
>
To get a gist of how a specific Android components is built, an easy way is to run `make showcommands `, where target is something like 'aapt'. This shows every command used to build that particular target, so it can be logged and replicated for a Debian build.
<
>
It is best to use the same android branch as the debian version, and to use releases in general. The Android master branch is something which moves fast, and as of now (6.0) it has a new, faster build system.
= NDEBUG =
Don't forget to define NDEBUG for C/C++ projects. It is set system wide for Android builds, and not setting it can lead to subtle bugs, such as when asserts are hit.
<
>
More info: [[https://bugs.debian.org/827216|#827216]] [[https://bugs.debian.org/827264|#827264]]
<
>
Example: [[http://deb.li/yXp2|git commit]]
= android.jar =
This file contains the public API of the android framework, used when compiling apps. Since it only contains the public parts from the source which also includes private APIs, it's build process is a bit complex.
1. [[https://android.googlesource.com/platform/external/doclava/|doclava]] [[https://android.googlesource.com/platform/frameworks/base/+/android-6.0.1_r43/Android.mk#805|processes]] the public parts of the API and puts the relevant files in a [[https://android.googlesource.com/platform/frameworks/base/+/android-6.0.1_r43/Android.mk#821|folder]].
2. [[#framework-res.apk|framework-res.apk]] is built from framework/base/core/res, which includes all the common image and string resources.
3. Both of the above are then used to [[https://android.googlesource.com/platform/development/+/android-6.0.1_r43/build/build_android_stubs.mk#32|create]] an android.jar including only the public API.
`make showcommands api-stubs-docs` output from Android 6.0: http://sprunge.us/QOgR
= framework-res.apk =
* Contains the common resources used by the system and apps.
* Source is in [[http://anonscm.debian.org/cgit/android-tools/android-platform-frameworks-base.git/tree/core/res?h=upstream/6.0.1%2br43|frameworks/base/core/res]]
* Can be easily built for Debian with `aapt package -x -M core/res/AndroidManifest.xml -S core/res/res -A core/res/assets -F framework-res.apk`
* Needed by [[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824933|apktool]]
* TODO: [[https://developer.android.com/studio/publish/app-signing.html|Sign]] it?
= doclava =
Used to build the SDK docs, and also generate public API stubs for [[#android.jar|android.jar]].
<
>
Upstream: https://code.google.com/archive/p/doclava/
<
>
Android fork's changes: https://android.googlesource.com/platform/external/doclava/+/android-6.0.1_r43/android-changes.txt
<
>
Built with gradle
= sources.zip =
It includes all the sources used to build android.jar, i.e. the public API of the android framework. Created by a [[https://android.googlesource.com/platform/development/+/android-6.0.1_r43/build/tools/mk_sources_zip.py|python script]]
= platform.zip =
Built using the files defined in [[https://android.googlesource.com/platform/development/+/android-6.0.1_r43/build/sdk.atree#137|development/build/sdk.atree]]