Adb install progress bar

故事扮演 提交于 2019-12-22 03:21:52

问题


I'm a beginner at this so just mind me if I ask anything obvious. I'm trying to install an apk to my device using adb install apk.apk however, the apk is around a few hundred MB big and it takes some time. Is there some sort of progress bar that I could implement in the command window to show the progress? I've seen stuff for adb push/pull . I'm not sure if it's the same. I'm running this in Windows 8.1. I also have an adb environment variable set up.

Thanks so much.


回答1:


Well, adb install apk.apk is just a glorified shortcut for:

adb push apk.apk /data/local/tmp
adb shell pm install /data/local/tmp/apk.apk
adb shell rm /data/local/tmp/apk.apk

So if you are so inclined to see the upload progress bar - just adb push -p your apk first and then adb shell pm install it either manually or with a simple script.




回答2:


if you're not calling the push/install operation (for example, Android Studio is doing it for you), you can query the push status as follows (bash script):

function check_push_progress(){
     local push_to=$1 #path in the device
     local push_from=$2 #path to local file
     local current=0
     local complete=1
     while [ $current -ne $complete ]; do
        current=`adb shell ls -l $push_to | awk '{print $5}'`
        complete=`ls -l $push_from | awk '{print $5}'`
        echo pushed $current bytes, out of $complete bytes, $((100*$current/$complete))%
        sleep 1
    done
}


来源:https://stackoverflow.com/questions/31891246/adb-install-progress-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!