diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d507b69d9f..6493b72b2a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -562,7 +562,7 @@ jobs: run: | python build-scripts/build-release.py \ --actions android \ - --android-api 23 \ + --android-api 21 \ --android-ndk-home "${{ steps.setup-ndk.outputs.ndk-path }}" \ --commit ${{ inputs.commit }} \ --root "${{ steps.tar.outputs.path }}" \ diff --git a/Android.mk b/Android.mk index 3ecc631d10..0f3138e5f4 100644 --- a/Android.mk +++ b/Android.mk @@ -108,6 +108,10 @@ LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid LOCAL_LDFLAGS := -Wl,--no-undefined -Wl,--no-undefined-version -Wl,--version-script=$(LOCAL_PATH)/src/dynapi/SDL_dynapi.sym +# https://developer.android.com/guide/practices/page-sizes +LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384" +LOCAL_LDFLAGS += "-Wl,-z,common-page-size=16384" + ifeq ($(NDK_DEBUG),1) cmd-strip := endif diff --git a/CMakeLists.txt b/CMakeLists.txt index b891873c65..0de10a1d90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1509,6 +1509,11 @@ if(ANDROID) endif() endif() +if(TARGET SDL3-shared) + target_link_options(SDL3-shared PRIVATE "-Wl,-z,max-page-size=16384") + target_link_options(SDL3-shared PRIVATE "-Wl,-z,common-page-size=16384") +endif() + elseif(EMSCRIPTEN) # Hide noisy warnings that intend to aid mostly during initial stages of porting a new # project. Uncomment at will for verbose cross-compiling -I/../ path info. diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle index 989ef34c71..f44cf26732 100644 --- a/android-project/app/build.gradle +++ b/android-project/app/build.gradle @@ -19,7 +19,7 @@ android { abiFilters 'arm64-v8a' } cmake { - arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static" + arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static", "-DAPP_SUPPORT_FLEXIBLE_PAGE_SIZES=true" // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' abiFilters 'arm64-v8a' } diff --git a/android-project/app/jni/Application.mk b/android-project/app/jni/Application.mk index 023bc20dfc..80b73fd6bc 100644 --- a/android-project/app/jni/Application.mk +++ b/android-project/app/jni/Application.mk @@ -7,4 +7,7 @@ APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 # Min runtime API level -APP_PLATFORM=android-16 +APP_PLATFORM=android-21 + +# https://developer.android.com/guide/practices/page-sizes#update-packaging +APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true \ No newline at end of file diff --git a/android-project/app/jni/src/CMakeLists.txt b/android-project/app/jni/src/CMakeLists.txt index 41a82f2af0..df0a4d0f34 100644 --- a/android-project/app/jni/src/CMakeLists.txt +++ b/android-project/app/jni/src/CMakeLists.txt @@ -26,4 +26,9 @@ endif() add_library(main SHARED YourSourceHere.c ) + +#https://developer.android.com/guide/practices/page-sizes#update-packaging +target_link_options(main PRIVATE "-Wl,-z,max-page-size=16384") +target_link_options(main PRIVATE "-Wl,-z,common-page-size=16384") + target_link_libraries(main PRIVATE SDL3::SDL3) diff --git a/build-scripts/androidbuildlibs.sh b/build-scripts/androidbuildlibs.sh index a903f36eea..1004a98703 100755 --- a/build-scripts/androidbuildlibs.sh +++ b/build-scripts/androidbuildlibs.sh @@ -30,6 +30,7 @@ abi="arm64-v8a" # "armeabi-v7a arm64-v8a x86 x86_64" obj= lib= ndk_args= +flexpage=true # Allow an external caller to specify locations and platform. while [ $# -gt 0 ]; do @@ -42,6 +43,8 @@ while [ $# -gt 0 ]; do platform=${arg#APP_PLATFORM=} elif [ "${arg:0:8}" == "APP_ABI=" ]; then abi=${arg#APP_ABI=} + elif [ "${arg:0:32}" == "APP_SUPPORT_FLEXIBLE_PAGE_SIZES=" ]; then + flexpage=${arg#APP_SUPPORT_FLEXIBLE_PAGE_SIZES=} else ndk_args="$ndk_args $arg" fi @@ -67,6 +70,9 @@ done # APP_* variables set in the environment here will not be seen by the # ndk-build makefile segments that use them, e.g., default-application.mk. # For consistency, pass all values on the command line. +# +# Add support for Google Play 16 KB Page size requirement: +# https://developer.android.com/guide/practices/page-sizes#ndk-build ndk-build \ NDK_PROJECT_PATH=null \ NDK_OUT=$obj \ @@ -75,4 +81,5 @@ ndk-build \ APP_ABI="$abi" \ APP_PLATFORM="$platform" \ APP_MODULES="SDL3" \ + APP_SUPPORT_FLEXIBLE_PAGE_SIZES="$flexpage" \ $ndk_args diff --git a/src/camera/android/SDL_camera_android.c b/src/camera/android/SDL_camera_android.c index ad39e63a38..90eb0007c5 100644 --- a/src/camera/android/SDL_camera_android.c +++ b/src/camera/android/SDL_camera_android.c @@ -814,7 +814,7 @@ static void ANDROIDCAMERA_Deinitialize(void) static bool ANDROIDCAMERA_Init(SDL_CameraDriverImpl *impl) { // !!! FIXME: slide this off into a subroutine - // system libraries are in android-24 and later; we currently target android-16 and later, so check if they exist at runtime. + // system libraries are in android-24 and later; we currently target android-21 and later, so check if they exist at runtime. void *libcamera2 = dlopen("libcamera2ndk.so", RTLD_NOW | RTLD_LOCAL); if (!libcamera2) { SDL_Log("CAMERA: libcamera2ndk.so can't be loaded: %s", dlerror());