-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Problem
When targeting newer Android devices with 16KB page sizes, some builds fail due to unaligned native libraries, especially when using the default RxDNSSD binaries. In addition to that, Google Play requires that all android apps are 16-KB aligned therefore unless this is patched, your app will not be accepted by Google.
Fix
To quickly fix the issue, tweak the RxDNSSD dependency to my prebuilt RnDNSSD libraries that support 16KB page sizes:
dependencies {
// Replace the original dependency:
// api 'com.github.andriydruk:RxDNSSD:0.9.16'
// Use the patched fork instead:
api 'com.github.jwh-hutchison:RxDNSSD:0.9.20'
}
This forked version includes .so libraries rebuilt with -Wl,-z,max-page-size=16384 for compatibility with 16KB page-size devices.
After running:
/check_elf_alignment.sh android/app/build/outputs/apk/release/app-release.apk
You will see that both x86_64 and arm64_v8a dnssd libraries are 16-kb aligned:
x86/libjdns_sd.so: \e[32mALIGNED\e[0m (2**14)
x86/libjdns_sd_embedded.so: \e[32mALIGNED\e[0m (2**14)
arm64-v8a/libjdns_sd.so: \e[32mALIGNED\e[0m (2**14)
arm64-v8a/libjdns_sd_embedded.so: \e[32mALIGNED\e[0m (2**14)
It's important that I add that:
This was published to jitpack rather than maven because I honestly didn't have time to set up signing, I recommend someone fork the RxDNSSD repo and deploy to maven with package signing, then open a PR for 'add 16-kb page-sizes' as a feature (which would then reference the RxDNSSD dependency in place of mine).