How to Use ADB Push/Pull with a Progress Bar

How to Use ADB Push/Pull with a Progress Bar

21 May 2024 Stephan Petzl Leave a comment Tech-Help

Transferring large files to and from your Android device using the adb push and adb pull commands can be cumbersome without any indication of progress. This guide will show you how to incorporate a progress bar into these operations, making the process more user-friendly.

Using ADB with Progress Support

Recent versions of ADB include built-in support for displaying progress during file transfers. To use this feature, simply add the -p flag to your adb push command:

adb push -p <local> <remote>

This command will display the transfer progress directly in your terminal.

Creating a Custom ADB Install Script

If you are looking to monitor progress during an adb install operation, which does not natively support a progress bar, you can create a custom script. Below is an example script that you can use:

# adb install with progressbar displayed
# usage:  

function usage() {
    echo "$0 "
    exit 1

function progressbar() {
    printf "\r[%-${barlength}s] %d%%" "${bar:0:n}" "$1"

export -f progressbar

[[ $# /dev/null 2>&1 || {
    echo "adb doesn't exist in your path"
    exit 3

SIZE=$(ls -l $SRC | awk '{print $5}')
export ADB_TRACE=all

adb install -r $SRC 2>&1 \
    | sed -n '/DATA/p' \
    | awk -v T=$SIZE 'BEGIN{FS="[=:]"}{t+=$7;system("progressbar " sprintf("%d\n", t/T*100))}'

export ADB_TRACE=

echo 'press any key'
read n

This script provides a visual representation of the installation progress. Save it as and make it executable. You can then use it to install APKs with a progress bar.

Enhancing Your Android Development Workflow

While these solutions are quite effective, integrating a comprehensive test automation tool like Repeato can further streamline your Android development process. Repeato is a no-code test automation tool for iOS and Android, enabling you to create, run, and maintain automated tests for your apps.

Repeato’s capabilities include:

  • Fast editing and running of tests
  • Utilizing computer vision and AI for test automation
  • Executing ADB commands via “script steps” for precise control

For more information on how Repeato can assist you, check out our documentation or visit our Android testing tool page.

By leveraging these tools and techniques, you can significantly improve your efficiency in managing and testing Android applications.

Like this article? there’s more where that came from!