Skip to content

Commit 0528722

Browse files
authored
fix: support android 15 16k page size (#109)
Part of AgoraIO-Extensions/Agora-Flutter-SDK#2041
1 parent fe29371 commit 0528722

File tree

4 files changed

+48
-7
lines changed

4 files changed

+48
-7
lines changed

.github/workflows/ci.yaml

+24-1
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,27 @@ jobs:
325325
api-level: 31
326326
arch: x86_64
327327
profile: Nexus 6
328-
script: bash tool/scripts/run_android_integration_test.sh
328+
script: bash tool/scripts/run_android_integration_test.sh
329+
330+
check_android15_16k_page_alignment:
331+
name: Check android15 16k page size alignment
332+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
333+
strategy:
334+
matrix:
335+
version: ['3.x']
336+
runs-on: ubuntu-latest
337+
steps:
338+
- uses: actions/checkout@v1
339+
- uses: actions/setup-java@v1
340+
with:
341+
java-version: '11'
342+
- uses: subosito/flutter-action@v2
343+
with:
344+
flutter-version: ${{ matrix.version }}
345+
cache: true
346+
- run: flutter pub get
347+
- name: Run flutter build apk
348+
run: flutter build apk
349+
working-directory: example
350+
- name: Check android15 16k page size alignment
351+
run: bash tool/scripts/check_android15_16k_page_alignment.sh example/build/app/intermediates/merged_native_libs/release/out/lib/arm64-v8a/libiris_method_channel.so

example/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

src/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ add_library(${LIBRARY_NAME} SHARED
2727
${SOURCES}
2828
)
2929

30-
# set_target_properties(hello PROPERTIES
31-
# PUBLIC_HEADER hello.h
32-
# OUTPUT_NAME "hello"
33-
# )
34-
3530
target_compile_definitions(${LIBRARY_NAME} PUBLIC DART_SHARED_LIB)
31+
32+
if(ANDROID)
33+
# Support Android 15 16k page size
34+
target_link_options(${LIBRARY_NAME} PRIVATE "-Wl,-z,max-page-size=16384")
35+
endif()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# usage: check_android15_16k_page_alignment.sh path/to/lib.so
4+
5+
SO_FILE="$1"
6+
7+
RED="\e[31m"
8+
GREEN="\e[32m"
9+
ENDCOLOR="\e[0m"
10+
11+
res="$(objdump -p ${SO_FILE} | grep LOAD | awk '{ print $NF }' | head -1)"
12+
if [[ $res =~ "2**14" ]] || [[ $res =~ "2**16" ]]; then
13+
echo -e "${SO_FILE}: ALIGNED ($res)"
14+
exit 0
15+
else
16+
echo -e "${SO_FILE}: UNALIGNED ($res)"
17+
exit 1
18+
fi

0 commit comments

Comments
 (0)