[av][core][gl][sqlite] support android 16kb page size
Why
fixes #37440
How
add -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON for ndk r27 to support 16kb page size
Test Plan
- tested on default sdk53 project
- check libs by objdump
Checklist
- [x] I added a
changelog.mdentry and rebuilt the package sources according to this short guide - [x] This diff will work correctly for
npx expo prebuild& EAS Build (eg: updated a module plugin). - [x] Conforms with the Documentation Writing Style Guide
The Pull Request introduced fingerprint changes against the base commit: 769d3b76187e93f404f261d63d7fdebedb871cf1
Fingerprint diff
[
{
"op": "changed",
"beforeSource": {
"type": "dir",
"filePath": "../../packages/expo-av/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "f198186f73b5723df7262f4e2c93f1e6173956d0"
},
"afterSource": {
"type": "dir",
"filePath": "../../packages/expo-av/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "7017e6654ed73b7ec6099aeec136088bcf30729e"
}
},
{
"op": "changed",
"beforeSource": {
"type": "dir",
"filePath": "../../packages/expo-gl",
"reasons": [
"expoAutolinkingIos",
"expoAutolinkingAndroid"
],
"hash": "b4c7b94141879381b1d8b444eb72e50433942017"
},
"afterSource": {
"type": "dir",
"filePath": "../../packages/expo-gl",
"reasons": [
"expoAutolinkingIos",
"expoAutolinkingAndroid"
],
"hash": "64dd9078342012e76ffa8aa4084f6af4c9a1d769"
}
},
{
"op": "changed",
"beforeSource": {
"type": "dir",
"filePath": "../../packages/expo-modules-core",
"reasons": [
"expoAutolinkingIos",
"expoAutolinkingAndroid"
],
"hash": "7827b7da31316cd0ccc37f488414e15bd29712a7"
},
"afterSource": {
"type": "dir",
"filePath": "../../packages/expo-modules-core",
"reasons": [
"expoAutolinkingIos",
"expoAutolinkingAndroid"
],
"hash": "611f7ed92af23d41efa5c2cbce0ba6d11486237b"
}
},
{
"op": "changed",
"beforeSource": {
"type": "dir",
"filePath": "../../packages/expo-sqlite/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "258af354801009260d6ddb89e4288dee0c711c91"
},
"afterSource": {
"type": "dir",
"filePath": "../../packages/expo-sqlite/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "f9ca49fddbeec190042f1391561fc6abe8c23b8a"
}
}
]
Generated by PR labeler 🤖
Subscribed to pull request
| File Patterns | Mentions |
|---|---|
| packages/expo-av/** | @lukmccall, @kudo |
| packages/expo-gl/** | @lukmccall |
| packages/expo-modules-core/** | @kudo, @lukmccall |
| packages/expo-sqlite/** | @kudo, @alanjhughes |
Generated by CodeMention
- #37454

- #37446
👈 (View in Graphite) main
This stack of pull requests is managed by Graphite. Learn more about stacking.
Merge activity
Hey @Kudo — I saw you're working on Android 16 KB page size support. I was wondering: would adding the compile flag to our app's build.gradle via an Expo plugin be sufficient, or do all native Android dependencies also need to include the -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON flag?
For example, an Expo build.gradle plugin that does something like this:
function addFlexiblePageSizesArgument(gradleContents) {
const argumentFlag = "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
// Regex to find existing arguments block
const argumentsRegex =
/(externalNativeBuild\s*\{[\s\S]*?arguments\s*\{)([\s\S]*?)(\})/m
if (argumentsRegex.test(gradleContents)) {
// If the argument is already present, do nothing
if (gradleContents.includes(argumentFlag)) {
return gradleContents
}
// Otherwise, append the argument inside the arguments block
return gradleContents.replace(
argumentsRegex,
(match, start, middle, end) => {
return `${start}${middle}\n ${argumentFlag}${end}`
},
)
}
// If no externalNativeBuild/arguments block, insert after defaultConfig {
const defaultConfigRegex = /(defaultConfig\s*\{[\s\S]*?\})/m
if (defaultConfigRegex.test(gradleContents)) {
const externalNativeBuildBlock = `externalNativeBuild {\n ndkBuild {\n arguments \n "${argumentFlag}"\n }\n }`
return gradleContents.replace(defaultConfigRegex, (match) => {
return `${match}\n ${externalNativeBuildBlock}`
})
}
// If neither found, return as is
return gradleContents
}
...
// Inject the flexible page sizes argument
config.modResults.contents = addFlexiblePageSizesArgument(
config.modResults.contents,
)
hey @watadarkstar, the problems were the libs from native modules like libexpo-modules-core.so or libexpo-gl.so. the app's build.gradle using config-plugin is not targeting for these libs. if you were not update to sdk 53, i would recommend using patch-package. also worth to note
- react-native core libs at least requires 0.77 to support 16kb page size: https://reactnative.dev/blog/2025/01/21/version-0.77
- you may need a different approach if you were using older ndk version: https://developer.android.com/guide/practices/page-sizes#compile-16-kb-alignment. sdk 52 (react-native 0.76) for instance, still has ndk r26