diff --git a/depends/README.md b/depends/README.md index ab1df59a884..c60b65bc849 100644 --- a/depends/README.md +++ b/depends/README.md @@ -34,8 +34,11 @@ Common `host-platform-triplet`s for cross compilation are: - `riscv32-linux-gnu` for Linux RISC-V 32 bit - `riscv64-linux-gnu` for Linux RISC-V 64 bit - `s390x-linux-gnu` for Linux S390X +- `armv7a-linux-android` for Android ARM 32 bit +- `aarch64-linux-android` for Android ARM 64 bit +- `x86_64-linux-android` for Android x86 64 bit -The paths are automatically configured and no other options are needed. +The paths are automatically configured and no other options are needed unless targeting [Android](../doc/build-android.md). ### Install the required dependencies: Ubuntu & Debian diff --git a/doc/README.md b/doc/README.md index 79ca53ce763..7492bb3cc47 100644 --- a/doc/README.md +++ b/doc/README.md @@ -45,6 +45,7 @@ The following are developer notes on how to build Bitcoin Core on your native pl - [FreeBSD Build Notes](build-freebsd.md) - [OpenBSD Build Notes](build-openbsd.md) - [NetBSD Build Notes](build-netbsd.md) +- [Android Build Notes](build-android.md) Development --------------------- diff --git a/doc/build-android.md b/doc/build-android.md new file mode 100644 index 00000000000..2dc7e453f99 --- /dev/null +++ b/doc/build-android.md @@ -0,0 +1,44 @@ +# Android Build Guide + +This guide describes how to build and package the `bitcoin-qt` GUI for Android on Linux and macOS. + + +## Dependencies + +Before proceeding with an Android build one needs to get the [Android SDK](https://developer.android.com/studio) and use the "SDK Manager" tool to download the NDK and one or more "Platform packages" (these are Android versions and have a corresponding API level). + +Qt 6.7.3 used in depends supports Android NDK version is [r26b (26.1.10909125)](https://github.com/android/ndk/wiki/Changelog-r26). + +In order to build `ANDROID_API_LEVEL` (API level corresponding to the Android version targeted, e.g. Android 9.0 Pie is 28 and its "Platform package" needs to be available) needs to be set. + +Qt 6.7.3 used in depends supports API levels from 26 to 34. + +When building [depends](../depends/README.md), additional variables `ANDROID_SDK` and `ANDROID_NDK` need to be set. + +This is an example command for a default build with no disabled dependencies: + + gmake HOST=aarch64-linux-android ANDROID_SDK=/home/user/Android/Sdk ANDROID_NDK=/home/user/Android/Sdk/ndk/26.1.10909125 ANDROID_API_LEVEL=34 + + +## Building and packaging + +After the depends are built configure, build and create an Android Application Package (APK) as follows (based on the example above): + +```bash +cmake -B build --toolchain depends/aarch64-linux-android/toolchain.cmake +cmake --build build --target apk_package # Use "-j N" for N parallel jobs. +``` + +The APKs will be available in the following directory: +```bash +$ tree build/src/qt/android/build/outputs/apk +build/src/qt/android/build/outputs/apk +├── debug +│ ├── android-debug.apk +│ └── output-metadata.json +└── release + ├── android-release-unsigned.apk + └── output-metadata.json + +3 directories, 4 files +```