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

后端 未结 20 2059
余生分开走
余生分开走 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条回答
  •  星月不相逢
    2020-11-30 19:22

    I was wanting to log what was happening whilst installing, also needed it to be slightly comprehendable. Ended up with:

    echo "Installing app on all connected devices."
    
    adb devices | tail -n +2 | cut -sf 1 | xargs -I % sh -c '{ \
        echo "Installing on %"; \
        adb -s % \
            install myApp.apk; \    
    ; }'
    

    Tested on Linux & Mac

提交回复
热议问题