diff --git a/.github/workflows/android-ci.yml b/.github/workflows/android-ci.yml index b375f3b5b10..47a4969c4ee 100644 --- a/.github/workflows/android-ci.yml +++ b/.github/workflows/android-ci.yml @@ -162,6 +162,12 @@ jobs: cp MapLibreAndroidTestApp/build/outputs/apk/drawable/release/MapLibreAndroidTestApp-drawable-release.apk . cp MapLibreAndroidTestApp/build/outputs/apk/androidTest/drawable/release/MapLibreAndroidTestApp-drawable-release-androidTest.apk . + # https://developer.android.com/guide/practices/page-sizes + - name: Check alignment of .apk + run: | + unzip -o MapLibreAndroidTestApp/build/outputs/apk/drawable/release/MapLibreAndroidTestApp-drawable-release.apk -d /tmp/my_apk_out + scripts/check-alignment.sh /tmp/my_apk_out + - name: Create artifact for benchmark APKs uses: actions/upload-artifact@v4 with: diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 9f1cdedbffb..0c26f69f5cf 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -8,6 +8,10 @@ ## 11.6.1 +### 🐞 Bug fixes + +- Fix 16K alignment Android builds ([#2995](https://github.com/maplibre/maplibre-native/issues/2995)). + ### ✨ Features and improvements - Allow configuring a `Call.Factory` instead of a `OkHttpClient` ([https://github.com/maplibre/maplibre-native/pull/2987](#2987)). Since an `OkHttpClient` can be assigned to a `Call.Factory` this should not cause any issues. diff --git a/platform/android/MapLibreAndroid/build.gradle.kts b/platform/android/MapLibreAndroid/build.gradle.kts index fbebf80a830..7d00169ca81 100644 --- a/platform/android/MapLibreAndroid/build.gradle.kts +++ b/platform/android/MapLibreAndroid/build.gradle.kts @@ -48,6 +48,8 @@ tasks.withType { } android { + ndkVersion = Versions.ndkVersion + defaultConfig { compileSdk = 34 minSdk = 21 diff --git a/platform/android/MapLibreAndroidTestApp/build.gradle.kts b/platform/android/MapLibreAndroidTestApp/build.gradle.kts index 5de8de1b877..c41fd48fd1c 100644 --- a/platform/android/MapLibreAndroidTestApp/build.gradle.kts +++ b/platform/android/MapLibreAndroidTestApp/build.gradle.kts @@ -19,6 +19,8 @@ fun obtainTestBuildType(): String { } android { + ndkVersion = Versions.ndkVersion + compileSdk = 34 defaultConfig { diff --git a/platform/android/scripts/check-alignment.sh b/platform/android/scripts/check-alignment.sh new file mode 100755 index 00000000000..5e26170dfe5 --- /dev/null +++ b/platform/android/scripts/check-alignment.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# usage: alignment.sh path to search for *.so files + +dir="$1" + +matches="$(find $dir -name "*.so" -type f)" +IFS=$'\n' + +err=0 + +for match in $matches; do + res="$(objdump -p ${match} | grep LOAD | awk '{ print $NF }' | head -1)" + if [[ $res =~ "2**14" ]] || [[ $res =~ "2**16" ]]; then + echo -e "${match}: ALIGNED ($res)" + else + if [[ "$match" == *"x86_64"* || "$match" == *"arm64-v8a"* ]]; then + echo "ERROR:" + err=1 + fi + echo -e "${match}: UNALIGNED ($res)" + fi +done + +exit $err \ No newline at end of file