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>

top

その他の投稿
20250912-01 Unity 6 で Editor がちらつく問題
20250906-01 Win10サポート終了 ChromeOS Flex を入れてみてつまづいた所
20250812-02 Unity UI Toolkit でのタップ操作検出
20250812-01 Unity UI Toolkit でマップ画面 with RenderTexture
20250811-01 Unity UI Toolkit での座標変換
20250721-01 Unityでカメラが平行投影の場合にScreenToWorldPointがズレる
20250712-01 Unity既存プロジェクトにURP追加
20250320-01 Unity のナビゲーションシステム 追記
20241013-01 Google Play で開発者情報が公開される件
20240824-01 Unity UI Toolkit カスタムコントロールサンプル