How can I adb install an apk to multiple connected devices?

后端 未结 20 2008
余生分开走
余生分开走 2020-11-30 19:03

I have 7 devices plugged into my development machine.

Normally I do adb install and can install to just a single device.

Now

20条回答
  •  Happy的楠姐
    2020-11-30 19:15

    PowerShell solution

    function global:adba() {
        $deviceIds = iex "adb devices" | select -skip 1 |  %{$_.Split([char]0x9)[0].Trim() } | where {$_ -ne "" }
        foreach ($deviceId in $deviceIds) {
            Echo ("--Executing on device " + $deviceId + ":---")
            iex ("adb -s $deviceId " + $args)
        }
    }
    

    Put this in your profile file (notepad $PROFILE), restart your shell and you can invoke installations with :

    adba install yourApp.apk
    

提交回复
热议问题