Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 16K alignment for Android build #2996

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

louwers marked this conversation as resolved.
Show resolved Hide resolved
- name: Create artifact for benchmark APKs
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions platform/android/MapLibreAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ tasks.withType<DokkaTask> {
}

android {
ndkVersion = Versions.ndkVersion

defaultConfig {
compileSdk = 34
minSdk = 21
Expand Down
2 changes: 2 additions & 0 deletions platform/android/MapLibreAndroidTestApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ fun obtainTestBuildType(): String {
}

android {
ndkVersion = Versions.ndkVersion

compileSdk = 34

defaultConfig {
Expand Down
25 changes: 25 additions & 0 deletions platform/android/scripts/check-alignment.sh
Original file line number Diff line number Diff line change
@@ -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
Loading