If your React Native Android app uses native libraries, it may be rejected by Google Play due to the new 16 KB page size requirement. This issue usually appears as unaligned .so files in your APK or AAB.
In this guide, you’ll learn how to detect, identify, and fix 16 KB alignment issues step by step, including how to update dependencies, verify compatibility, and patch libraries when needed.
Keywords: React Native Android, 16 KB page size, Google Play compliance, fix unaligned .so, APK alignment issue
Key points:
-
Only arm64-v8a and x86_64 need to comply
-
armeabi-v7a (32-bit) is exempt
-
Apps without native modules are already compliant
-
React Native core is compliant from v0.76+
Step 1: Build a Release APK for React Native Android
cd android
./gradlew assembleRelease
APK location:
android/app/build/outputs/apk/release/app-release.apk
Step 2: Check 16 KB Page Size Alignment in APK
Create a script check_16kb_alignment.sh:
#!/bin/bash
APK_FILE="$1"
TEMP_DIR=$(mktemp -d)
unzip -q "$APK_FILE" -d "$TEMP_DIR"
unaligned=0
for arch_dir in "$TEMP_DIR/lib"/*/; do
arch=$(basename "$arch_dFir")
if [ "$arch" != "arm64-v8a" ] && [ "$arch" != "x86_64" ]; then
echo "Skipping $arch"
continue
fi
echo "Architecture: $arch"
for so in "$arch_dir"*.so; do
[ -f "$so" ] || continue
res=$(objdump -p "$so" 2>/dev/null | grep LOAD | awk '{print $NF}' | head -1)
name=$(basename "$so")
if echo "$res" | grep -qE '2\*\*(1[0-3]|[0-9]$)'; then
echo " UNALIGNED $name ($res)"
unaligned=$((unaligned + 1))
else
echo " ALIGNED $name ($res)"
fi
done
done
rm -rf "$TEMP_DIR"
[ $unaligned -gt 0 ] \
&& echo "FAILED: $unaligned unaligned libs found." \
|| echo "PASSED: All libs are aligned."
Run it:
chmod +x check_16kb_alignment.sh
./check_16kb_alignment.sh android/app/build/outputs/apk/release/app-release.apk
Step 3: Identify Unaligned Native Libraries (.so files)
If you see UNALIGNED, find which package caused it.
Search build files:
find android -name "libexample.so"
Search node_modules:
grep -r "example" node_modules --include="CMakeLists.txt" -l
Common mapping:
-
libreact_native_camera.so → react-native-camera
-
librnmmkv.so → react-native-mmkv
-
libreact_native_sqlite.so → react-native-sqlite-storage
Step 4: Update Dependencies to Fix 16 KB Alignment
Before updating, check if a compatible version exists.
Check latest version
npm show <package-name> version
Check all available versions
npm view <package-name> versions
Check peer dependencies (important for compatibility)
npm view <package-name>@latest peerDependencies
This helps ensure the package works with your current React Native version and other libraries.
Update the package
npm install <package>@latest
# or
yarn upgrade <package>
Verify dependency compatibility
After updating, check for conflicts:
npm ls <package-name>
Or check all dependency issues:
npm ls
If a package requires a specific React Native version, install a compatible version instead of the latest:
npm install <package>@<compatible-version>
Step 5: Fix 16 KB Alignment by Patching Native Libraries
If no fix is available, patch it locally.
Find CMakeLists.txt:
find node_modules/<package> -name "CMakeLists.txt"
Add:
target_link_options(your_target_name
PRIVATE
"-Wl,-z,max-page-size=16384"
)
Use patch-package
npm install --save-dev patch-package
npx patch-package <package-name>
Add to package.json:
"scripts": {
"postinstall": "patch-package"
}
Rebuild and Verify
cd android
./gradlew assembleRelease
./check_16kb_alignment.sh android/app/build/outputs/apk/release/app-release.apk
You should see:
PASSED: All libs are aligned.
Conclusion
16 KB page size compliance is now required for apps using native libraries on Google Play. If your app is not compliant, Play Store submissions or updates may be rejected.
It mainly involves fixing dependencies that are not aligned. Adding a verification step to your workflow helps ensure ongoing compliance as your app evolves.