@@ -31,8 +31,8 @@ cmake --build build -j8 --target run
3131Linux users will need to install some pre-requisites for this template to compile.
3232
3333``` shell
34- sudo apt-get update
35- sudo apt-get install cmake libx11-dev libxfixes-dev libegl-dev libgbm-dev libfontconfig-dev
34+ sudo apt update
35+ sudo apt install cmake libx11-dev libxfixes-dev libegl-dev libgbm-dev libfontconfig-dev
3636```
3737
3838# Android
@@ -45,6 +45,53 @@ This template also supports building and running APKs for Android! Setup for thi
4545
4646To build for Android, you need a few SDKs! [ Android Studio] ( https://developer.android.com/studio ) has a good interface for grabbing these, and doubles as a nice tool for inspecting APKs.
4747
48+
49+ ### If building on Ubuntu 24.04 onwards (CLI): Quick setup
50+ If you prefer the command line on Linux, this is a minimal setup that matches the versions this template targets.
51+
52+ ### Auto-Setup:
53+
54+ Just run ` bash install_android_deps.sh ` . Everything will be installed for you.
55+
56+ ### Manual Setup:
57+ <details >
58+
59+ ``` bash
60+ # 1) Base tools
61+ sudo apt update
62+ sudo apt install cmake libx11-dev libxfixes-dev libegl-dev libgbm-dev libfontconfig-dev unzip curl zip ninja-build openjdk-8-jdk adb google-android-cmdline-tools-13.0-installer
63+
64+ # 2) to rule out potential errors, we explicitly tell sdkmanager where to install the Android SDK & NDK
65+
66+ export ANDROID_HOME=" $HOME /Android/Sdk"
67+
68+ sdkmanager --sdk_root=$ANDROID_HOME \
69+ " platform-tools" \
70+ " platforms;android-32" \
71+ " build-tools;32.0.0" \
72+ " ndk;25.2.9519653"
73+
74+ # 3) More environment variable setup...:
75+
76+ export ANDROID_SDK_ROOT=" $ANDROID_HOME "
77+ export PATH=" $ANDROID_HOME /platform-tools:$PATH "
78+
79+ # 5) Point CMake to the NDK and set JAVA_HOME (OpenJDK 8 on Ubuntu)
80+ export ANDROID_NDK_HOME=" $ANDROID_HOME /ndk/25.2.9519653"
81+ export JAVA_HOME=" /usr/lib/jvm/java-8-openjdk-amd64"
82+
83+ # (Optional) Persist these to your shell profile (after install)
84+ echo ' export ANDROID_HOME="$HOME/Android/Sdk"' >> " $HOME /.bashrc"
85+ echo ' export ANDROID_SDK_ROOT="$HOME/Android/Sdk"' >> " $HOME /.bashrc"
86+ echo ' export ANDROID_NDK_HOME="$HOME/Android/Sdk/ndk/25.2.9519653"' >> " $HOME /.bashrc"
87+ echo ' export PATH="$ANDROID_HOME/platform-tools:$PATH"' >> " $HOME /.bashrc"
88+ echo ' export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"' >> " $HOME /.bashrc"
89+ ```
90+ </details >
91+
92+ ### Now you can continue to Android Build section.
93+
94+
4895### Android SDKs
4996From [ Android Studio] ( https://developer.android.com/studio ) , go to Tools->SDK Manager.
5097- Under SDK Platforms, add ** API Level 32**
@@ -94,6 +141,10 @@ Ninja's [site is here](https://ninja-build.org/), but you can install it quite e
94141
95142## Android Build
96143
144+ ### for automated Android Build on Linux just run ` build_android.sh `
145+
146+
147+
97148``` shell
98149# From the project root directory
99150
@@ -102,6 +153,7 @@ mkdir build-android
102153
103154# Configure the build, I'll often make a .bat file for this configure command
104155# just to make it easier to do!
156+
105157cmake -B build-android ^
106158 -G Ninja ^
107159 -DCMAKE_ANDROID_NDK=%ANDROID_NDK_HOME% ^
@@ -110,6 +162,11 @@ cmake -B build-android ^
110162 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a
111163# Same, but as a single line. Nicer if not using a .bat
112164cmake -B build-android -G Ninja -DCMAKE_ANDROID_NDK=%ANDROID_NDK_HOME% -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=32 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a
165+
166+ # Or for Linux:
167+ cmake -B build-android -G Ninja -DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=32 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a
168+
169+
113170# Build an APK, install, and run it
114171cmake --build build-android -j8 --target run
115172# Or just build an APK
0 commit comments