Skip to content

Instantly share code, notes, and snippets.

@SimonDarksideJ
Created October 10, 2025 11:42
Show Gist options
  • Save SimonDarksideJ/d42e73c0030114b6370ef1dc0c0d94dd to your computer and use it in GitHub Desktop.
Save SimonDarksideJ/d42e73c0030114b6370ef1dc0c0d94dd to your computer and use it in GitHub Desktop.
Google 16kb checker for Android Builds
# To use (with Unity)
# 1. Build the Android APK
# 2. Unzip the apk to a folder
# 3. Locate the libs folder, normally - "\lib\arm64-v8a"
# 4. run script in the folder, a .csv will be generated
# 5. Check the last entry for each .so entry:
# - 1000 - NOT compliant
# - 4000 - 16kb Compliant
param(
[Parameter(Mandatory = $true)]
[string]$ReadElfPath
)
# Pass path to your local llvm-readelf.exe, e.g.
#$ReadElfPath = 'Unity\Editors\6000.0.59f2\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-readelf.exe'
Get-ChildItem -Recurse -Filter *.so | ForEach-Object {
$file = $_.FullName
& $ReadElfPath -l $file |
Select-String 'LOAD' | ForEach-Object {
$line = $_.Line.Trim()
# try to extract the Align token (last hex/decimal token)
$tokens = ($line -split '\s+') | Where-Object { $_ -ne '' }
$align = ($tokens | Select-String -Pattern '^(0x[0-9a-fA-F]+|\d+)$' -AllMatches).Matches |
Select-Object -Last 1 | ForEach-Object { $_.Value }
[PSCustomObject]@{
Filename = $file
LineText = $line
Align = $align
}
}
} | Export-Csv -Path align-readelf.csv -NoTypeInformation -Encoding UTF8
@paulocoutinhox
Copy link

I made a tool in Python cross-platform to check APK, AAB and SO: https://cavfy.com/article/como-validar-o-alinhamento-de-16kb-em-apks-aabs-e-sos/263012/

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