fix(android): 16k issue wip

This commit is contained in:
devthejo 2025-09-26 20:12:34 +02:00
parent 018ba5c04a
commit f83edfba27
No known key found for this signature in database
GPG key ID: 00CCA7A92B1D5351
2 changed files with 40 additions and 0 deletions

View file

@ -83,6 +83,9 @@ android {
applicationId 'com.alertesecours'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
versionCode 214
versionName "1.13.2"
multiDexEnabled true
@ -163,6 +166,18 @@ configurations.all {
resolutionStrategy {
// Force non-native UCrop artifact (no .so), avoids 64KB page size issue from 2.2.6-native
force "com.github.yalantis:ucrop:2.2.6"
// Force Fresco/FBJNI versions with 16KB page support (or newer)
force "com.facebook.fresco:fresco:3.3.0"
force "com.facebook.fresco:imagepipeline:3.3.0"
force "com.facebook.fresco:imagepipeline-native:3.3.0"
force "com.facebook.fresco:gifdecoder:3.3.0"
force "com.facebook.fresco:nativeimagetranscoder:3.3.0"
force "com.facebook.fresco:static-webp:3.3.0"
force "com.facebook.fresco:webpsupport:3.3.0"
force "com.facebook.fresco:animated-webp:3.3.0"
force "com.facebook.fresco:animated-gif:3.3.0"
force "com.facebook.fbjni:fbjni:0.6.0"
}
// Exclude Huawei UCS native credential libs from Play build (causes 64KB alignment)
exclude group: "com.huawei.hms", module: "ucs-credential"

View file

@ -65,3 +65,28 @@ allprojects {
}
}
}
/**
* Force 16KB page size at link time for all subprojects that build native code with CMake.
* Use projectsEvaluated to avoid afterEvaluate on already-evaluated projects.
*/
gradle.projectsEvaluated {
subprojects { proj ->
def androidExt = proj.extensions.findByName("android")
if (androidExt != null &&
androidExt.hasProperty("externalNativeBuild") &&
androidExt.externalNativeBuild?.cmake != null) {
try {
def flag = "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=16384"
def args = androidExt.externalNativeBuild.cmake.arguments
if (args == null || args.isEmpty()) {
androidExt.externalNativeBuild.cmake.arguments = [flag]
} else if (!args.contains(flag)) {
androidExt.externalNativeBuild.cmake.arguments += flag
}
} catch (Throwable ignored) {
// ignore if structure differs for a subproject
}
}
}
}