原理:来自 Google 的云端优化,这个技巧让你的应用秒开

V2

获取第三方应用包列表,存入变量:

    $PackageList = adb shell pm list packages -3

新建计数变量:

    $Index = 1

遍历每行应用包名,编译:

    foreach($PackageListLine in $PackageList)
    {
        $PackageName = $PackageListLine.Remove(0, 8)
        echo("Compiling " + $Index++ +"/" + $PackageList.Count + " " + $PackageName)
        adb shell cmd package compile -m speed -f $PackageName
    }

输出效果:
Snipaste_2020-04-20_21-40-54.png


V1

获取第三方应用列表:

    adb shell pm list packages -3 > packages.txt

Powershell中运行adb,批量编译第三方应用:

    foreach($line in Get-Content("packages.txt"))
    {
        $PackgeName = $line.Remove(0,8)
        echo("compiling " + $PackgeName)
        adb shell cmd package compile -m speed -f $PackgeName
    }

删除临时文件:

    Remove-Item("packages.txt")

标签: none

添加新评论