Skip to content

Commit f8a62dd

Browse files
Merge pull request #227 from bernardladenthin/claude/sharp-sagan-3f10fy
Upgrade Android minimum API level from 24 to 28
2 parents 20e734b + 2af0b62 commit f8a62dd

6 files changed

Lines changed: 39 additions & 16 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
- uses: github/codeql-action/init@v4
2626
with: { languages: java, queries: +security-and-quality }
2727
- name: Build with Maven
28-
run: mvn --batch-mode compile
28+
run: mvn --batch-mode --no-transfer-progress compile
2929
- uses: github/codeql-action/analyze@v4
3030
with: { category: "/language:java" }

.github/workflows/publish.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
- name: Build libraries
165165
shell: bash
166166
run: |
167-
.github/dockcross/dockcross-android-arm64 .github/build.sh "-DANDROID_PLATFORM=android-24 -DOS_NAME=Linux-Android -DOS_ARCH=aarch64"
167+
.github/dockcross/dockcross-android-arm64 .github/build.sh "-DANDROID_PLATFORM=android-28 -DOS_NAME=Linux-Android -DOS_ARCH=aarch64"
168168
- name: Upload artifacts
169169
uses: actions/upload-artifact@v7
170170
with:
@@ -180,7 +180,7 @@ jobs:
180180
- name: Build libraries
181181
shell: bash
182182
run: |
183-
.github/dockcross/dockcross-android-arm64 .github/build_opencl_android.sh "-DANDROID_PLATFORM=android-24 -DOS_NAME=Linux-Android -DOS_ARCH=aarch64 -DGGML_OPENCL=ON -DGGML_OPENCL_EMBED_KERNELS=ON -DGGML_OPENCL_USE_ADRENO_KERNELS=ON"
183+
.github/dockcross/dockcross-android-arm64 .github/build_opencl_android.sh "-DANDROID_PLATFORM=android-28 -DOS_NAME=Linux-Android -DOS_ARCH=aarch64 -DGGML_OPENCL=ON -DGGML_OPENCL_EMBED_KERNELS=ON -DGGML_OPENCL_USE_ADRENO_KERNELS=ON"
184184
- name: Upload artifacts
185185
uses: actions/upload-artifact@v7
186186
with:
@@ -212,7 +212,7 @@ jobs:
212212
- name: Build libraries
213213
shell: bash
214214
run: |
215-
mvn compile
215+
mvn --no-transfer-progress compile
216216
.github/build.sh -DLLAMA_METAL=OFF -DGGML_NATIVE=OFF -DBUILD_TESTING=ON
217217
- name: Run C++ unit tests
218218
run: ctest --test-dir build --output-on-failure
@@ -243,7 +243,7 @@ jobs:
243243
- name: Build libraries
244244
shell: bash
245245
run: |
246-
mvn compile
246+
mvn --no-transfer-progress compile
247247
.github/build.sh -DLLAMA_METAL_EMBED_LIBRARY=ON -DBUILD_TESTING=ON
248248
- name: Run C++ unit tests
249249
run: ctest --test-dir build --output-on-failure
@@ -334,7 +334,7 @@ jobs:
334334
cat /proc/cpuinfo
335335
- name: Build libraries
336336
run: |
337-
mvn -q compile
337+
mvn -q --no-transfer-progress compile
338338
.github/build.sh -DBUILD_TESTING=ON
339339
- name: Run C++ unit tests
340340
run: ctest --test-dir build --output-on-failure
@@ -360,7 +360,7 @@ jobs:
360360
- name: Build libraries
361361
shell: bash
362362
run: |
363-
mvn compile
363+
mvn --no-transfer-progress compile
364364
.github/build.sh -DLLAMA_METAL_EMBED_LIBRARY=ON -DGGML_NATIVE=OFF -DBUILD_TESTING=ON
365365
- name: Run C++ unit tests
366366
run: ctest --test-dir build --output-on-failure
@@ -873,7 +873,7 @@ jobs:
873873
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
874874
gpg-passphrase: MAVEN_GPG_PASSPHRASE
875875
- name: Publish snapshot
876-
run: mvn --batch-mode -P release,cuda,opencl-android -Dmaven.test.skip=true deploy
876+
run: mvn --batch-mode --no-transfer-progress -P release,cuda,opencl-android -Dmaven.test.skip=true deploy
877877
env:
878878
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
879879
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
@@ -948,7 +948,7 @@ jobs:
948948
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
949949
gpg-passphrase: MAVEN_GPG_PASSPHRASE
950950
- name: Publish release
951-
run: mvn --batch-mode -P release,cuda,opencl-android -Dmaven.test.skip=true deploy
951+
run: mvn --batch-mode --no-transfer-progress -P release,cuda,opencl-android -Dmaven.test.skip=true deploy
952952
env:
953953
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
954954
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}

.github/workflows/sonarqube.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
- name: Build and analyze
3838
env:
3939
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40-
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=bernardladenthin_java-llama.cpp
40+
run: mvn -B --no-transfer-progress verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=bernardladenthin_java-llama.cpp

CLAUDE.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ git add .github/build_cuda_linux.sh pom.xml CLAUDE.md
3838
git commit -m "Upgrade CUDA from 13.2 to 13.3"
3939
```
4040

41+
## Android minimum API level
42+
43+
Current Android minimum API level: **28** (Android 9.0 Pie)
44+
45+
To change the minimum API level, update the following **three** places:
46+
47+
1. **`CMakeLists.txt`** — the `add_compile_definitions(__ANDROID_API__=28)` line (controls which NDK header symbols are exposed).
48+
2. **`.github/workflows/publish.yml`**`-DANDROID_PLATFORM=android-28` in both the `crosscompile-android-aarch64` and `crosscompile-android-aarch64-opencl` job steps.
49+
3. **`CLAUDE.md`** (this file) — the "Current Android minimum API level" line above and the `-DANDROID_PLATFORM` values in the local sanity-build examples.
50+
51+
Also update the minimum-API note in **`README.md`** (the `[!NOTE]` block near the Android classifier entries and the "Importing in Android" section).
52+
53+
**Why API 28?** `mtmd-helper.cpp` (part of the upstream llama.cpp `mtmd` multimodal library) includes `vendor/sheredom/subprocess.h`, which calls `posix_spawn`, `posix_spawnp`, and `posix_spawn_file_actions_*`. The Android NDK headers only expose those declarations when `__ANDROID_API__ >= 28`. The symbols exist in `libc.so` at all API levels; the define only gates their header visibility.
54+
4155
## OpenCL / Adreno backend on Android
4256

4357
A second Android arm64 artifact is built with the OpenCL backend enabled and
@@ -62,7 +76,7 @@ Three places wire it together (mirrors the CUDA classifier pattern):
6276
Local sanity build:
6377
```bash
6478
.github/dockcross/dockcross-android-arm64 .github/build_opencl_android.sh \
65-
"-DANDROID_PLATFORM=android-24 -DOS_NAME=Linux-Android -DOS_ARCH=aarch64 \
79+
"-DANDROID_PLATFORM=android-28 -DOS_NAME=Linux-Android -DOS_ARCH=aarch64 \
6680
-DGGML_OPENCL=ON -DGGML_OPENCL_EMBED_KERNELS=ON \
6781
-DGGML_OPENCL_USE_ADRENO_KERNELS=ON"
6882
```

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_L
4747
link_libraries(stdc++fs)
4848
endif()
4949

50-
# Android standalone toolchains default to API level 21, but cpp-httplib uses
51-
# getifaddrs/freeifaddrs which are only declared in <ifaddrs.h> when
52-
# __ANDROID_API__ >= 24. NDK unified sysroots (r14b+) include the symbol in
53-
# libc regardless of level; this exposes the declaration for all targets.
50+
# Android NDK headers gate symbols on __ANDROID_API__:
51+
# >= 24: getifaddrs/freeifaddrs (<ifaddrs.h>), needed by cpp-httplib.
52+
# >= 28: posix_spawn / posix_spawnp / posix_spawn_file_actions_* (<spawn.h>),
53+
# needed by mtmd-helper.cpp (vendor/sheredom/subprocess.h).
54+
# NDK unified sysroots (r14b+) include all these symbols in libc regardless of
55+
# level; the define only controls which declarations are visible in the headers.
5456
if(ANDROID_ABI)
55-
add_compile_definitions(__ANDROID_API__=24)
57+
add_compile_definitions(__ANDROID_API__=28)
5658
endif()
5759

5860
set(LLAMA_BUILD_COMMON ON)

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ Pick at most one — they are mutually exclusive.
202202
> by the released artifacts; building from source via the
203203
> `.github/dockcross/dockcross-android-arm` toolchain is possible but not
204204
> wired into CI.
205+
>
206+
> The minimum required Android version is **API 28 (Android 9.0 Pie)**.
207+
> Devices running Android 8.1 (API 27) or earlier are not supported.
205208
206209
### Setup required
207210

@@ -506,6 +509,10 @@ The `LogLevel` enum values passed to the callback correspond to the native llama
506509

507510
## Importing in Android
508511

512+
> [!IMPORTANT]
513+
> **Minimum Android version: API 28 (Android 9.0 Pie).** Devices running
514+
> Android 8.1 (API 27) or earlier are not supported.
515+
509516
You can use this library in Android project.
510517
1. Add java-llama.cpp as a submodule in your an droid `app` project directory
511518
```shell

0 commit comments

Comments
 (0)