Unity アプリで Android 16KB ページサイズ確認
初めに
Google Play からのお知らせで、16KBページサイズに対応してね、というのが来たので対応しています。
まずは確認という事で、スクリプトを作ったので共有します。
自己責任でご利用ください。
参考
Android15で追加される16KBページサイズの対応について詳しくみていく https://qiita.com/kokada420/items/aa2ec4afcd727a7f4e38
16 KB ページサイズのサポート https://developer.android.com/guide/practices/page-sizes?hl=ja#windows-powershell
PowerShell
param(
[Parameter(Mandatory=$true)]
[string]$targetApkPath,
[Parameter(Mandatory=$true)]
[string]$unityVersion
)
if (-Not (Test-Path -Path $targetApkPath)) {
Write-Error "The specified APK file does not exist: $targetApkPath"
exit 1
}
$toolPath = "C:\Program Files\Unity\Hub\Editor\$unityVersion\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-objdump.exe"
if (-Not (Test-Path -Path $toolPath)) {
Write-Error "The specified tool does not exist: $toolPath"
exit 1
}
$workspacePath = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([System.Guid]::NewGuid().ToString())
Expand-Archive -Path $targetApkPath -DestinationPath $workspacePath -Force
$soFiles = Get-ChildItem -Path $workspacePath -Recurse -Filter "*.so"
foreach ($soFile in $soFiles) {
& "$toolPath" -p $soFile.FullName | Select-String -Pattern "LOAD" | ForEach-Object {
$line = $_.ToString()
if ($line -match "LOAD\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)") {
$align = $matches[8]
if ($align -notmatch "2\*\*14") {
$soFileRelative = $soFile.FullName.Substring($workspacePath.Length)
Write-Output "$align $soFileRelative"
}
}
else {
Write-Output "No LOAD information found in file $soFile"
}
}
}
Remove-Item -Path $workspacePath -Recurse -Force
Write-Output "Check completed."
実行方法と結果の例
apkとありますがaabも渡せます。
PS D:\Git> .\CheckAndroidPageSize16KB.ps1 "D:\Git\KoKoCoin\Build\KoKoCoin_release_1.0.7.aab" "6000.2.4f1"
2**12 \base\lib\arm64-v8a\libparty.so
2**12 \base\lib\arm64-v8a\libparty.so
2**12 \base\lib\armeabi-v7a\libc++_shared.so
2**12 \base\lib\armeabi-v7a\libc++_shared.so
2**12 \base\lib\armeabi-v7a\libc++_shared.so
2**12 \base\lib\armeabi-v7a\libc++_shared.so
2**12 \base\lib\armeabi-v7a\libparty.so
2**12 \base\lib\armeabi-v7a\libparty.so
2**12 \base\lib\armeabi-v7a\libswappywrapper.so
2**12 \base\lib\armeabi-v7a\libswappywrapper.so
2**12 \base\lib\armeabi-v7a\libswappywrapper.so
Check completed.
PS D:\Git>