Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 9, 2025

Summary

This PR implements support for Android 16KB page sizes, which is required by Google Play starting November 1st, 2025 for all new apps and updates targeting Android 15+ devices.

Changes Made

1. CMake Build Configuration

  • Added -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON flag to enable flexible page size support
    • Updated in build.py (main build script)
    • Updated in examples/slm_engine/build_scripts/build.py
    • Updated in examples/slm_engine/build_scripts/build_deps.py
  • Added -Wl,-z,max-page-size=16384 linker flag for shared libraries on Android
    • Updated in CMakeLists.txt to set CMAKE_SHARED_LINKER_FLAGS for proper 16KB ELF alignment

2. Gradle Plugin Updates

  • Updated Android Gradle Plugin from 7.4.2 to 8.1.0
    • Updated in src/java/build-android.gradle
    • Updated in src/java/src/test/android/build.gradle

3. Android SDK Version Updates

  • Updated compileSdkVersion from 32 to 34
  • Updated targetSdkVersion to use the targetSdkVer variable (set to 34 in CI settings)
    • Updated in src/java/build-android.gradle
    • Updated in src/java/src/test/android/app/build.gradle
    • Updated in tools/ci_build/github/android/default_aar_build_settings.json

4. Documentation

  • Added Android 16KB page size support section to AndroidBuild.md
  • Documented compliance requirements and changes

Compatibility

  • Gradle wrapper version 8.6 (already in place) is compatible with plugin 8.1.0
  • Minimum SDK version remains at 24 (no breaking changes for existing users)
  • Changes are backward compatible with 4KB page sizes

References

Testing Notes

Manual testing recommended:

  • Build Android AAR packages with updated configuration
  • Test on devices with 16KB page sizes (or emulators)
  • Verify existing functionality on 4KB page size devices
Original prompt

Starting November 1st, 2025, all new apps and updates to existing apps submitted to Google Play and targeting Android 15+ devices must support 16 KB page sizes.

It seems our Android builds don't support the new guideline. This would mean possible NDK update, possible gradle plugin updates and recompiling with 16KB target. I say possible because they do seem to provide some flags we can pass in cmake and ndk-build commands to avoid the upgrades. But it might also break existing code.

lib/arm64-v8a/libonnxruntime-genai.so
lib/x86_64/libonnxruntime-genai.so

The onnxruntime library did not come up in the warning, but needs to be checked.

practices/page-sizes

We also have similar PR in onnxruntime that can be used as reference https://github.com/microsoft/onnxruntime/pulls?q=is%3Apr+is%3Aclosed+16kb+android


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits October 10, 2025 00:04
Co-authored-by: sheetalarkadam <100380551+sheetalarkadam@users.noreply.github.com>
Co-authored-by: sheetalarkadam <100380551+sheetalarkadam@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Android builds to support 16 KB page sizes Add Android 16KB page size support for Google Play compliance Oct 10, 2025
Copilot AI requested a review from sheetalarkadam October 10, 2025 00:09
@sheetalarkadam sheetalarkadam removed their assignment Oct 10, 2025
….gradle

Co-authored-by: sheetalarkadam <100380551+sheetalarkadam@users.noreply.github.com>
@sheetalarkadam
Copy link

@copilot any cmake file changes needed like - https://github.com/microsoft/onnxruntime/pull/22076/files

Co-authored-by: sheetalarkadam <100380551+sheetalarkadam@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 10, 2025

@copilot any cmake file changes needed like - https://github.com/microsoft/onnxruntime/pull/22076/files

Added the CMake linker flag -Wl,-z,max-page-size=16384 for Android shared libraries in CMakeLists.txt, following the same approach as ONNX Runtime PR #22076. This ensures proper 16KB ELF alignment for shared libraries. Commit: 8b6c1a7

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/microsoft/onnxruntime/pulls/22076/files
    • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants