ADB Push and ADB Pull can be very useful if you want to quickly copy a file to or from your Android device. ADB also called Android Debug Bridge is a tiny yet powerful tool that is built right into the core of the Android Operating system. You can perform a variety of operations by using the ADB Commands on your Android device. ADB comes in handy particularly when your device is non-responsive. In such cases, you can use the ADB command-line tool to take control of your device. You can take a screenshot, install an app, uninstall an app, reboot your device into bootloader mode or recovery mode, and much more.
Similarly, you can use ADB commands to transfer files to and from your Android device. In this guide, we will tell you how you can use ADB Pull and ADB Push command to copy files to and from your Android device easily.
Push and Pull Files Using ADB Commands
Before you begin, please make sure you have are good with all the points mentioned below:
- Make sure that your device has enough battery left so that it won’t switch off in the middle of the process.
- Download and install proper Android USB Drivers on your computer.
- Enable USB Debugging on your phone from Settings > Developer options.
- Setup ADB and Fastboot tools on your computer. Follow any one of the below guides:
How to use ADB Pull Command to copy a file from Android
- Make sure you have installed ADB and Fastboot tools on your computer.
- Go to the folder where you have the ADB and Fastboot tools. Open a command prompt from inside this folder. To do this: Hold down Shift Key and Right-click on the empty space inside the folder and then select ‘Open command window here‘ or ‘Open PowerShell window here‘.
- To pull a file from your Android device, you need to give the FULL PATH of the file. You can use the following command to ADB Pull a file from an Android device:
adb pull </path/filename>
You need to give the filename with the extension.
For example, let us say you are pulling a file called reddit.apk, then you need to have the command like:adb pull /system/app/Reddit.apk
- Once you execute the command, the file will be copied from your Android device and saved on the folder where ADB and Fastboot are installed.
How to use ADB Push Command to Copy a File to Android
- Make sure you have installed ADB and Fastboot tools on your computer.
- Go to the folder where you have the ADB and Fastboot tools. Open a command prompt from inside this folder. To do this: Hold down Shift Key and Right-click on the empty space inside the folder and then select ‘Open command window here‘ or ‘Open PowerShell window here‘.
- To push a file to your Android device, you need to give the FULL PATH of the file. You can use the following command to ADB Push a file to your Android device:
adb push <source-path> <target-path>
For example:
adb push /local/path/Reddit.apk /sdcard/apps/
Caution: If you are pushing files to your SD Card or Internal Storage, then the above command will work fine. But, if you are pushing files to the /system partition, then you need to system partition as writable first and then proceed. Also, to push files into /system partition, you need root access on your Android.
- To mount the system partition to Read-Write, execute the following commands one after another:
adb shell su mount -o remount,rw /system
- When you execute the above command, you might get a prompt on your Android device asking for root permissions. Grant the same.
- After mounting the /system partition to read-write, you can use the following command to ADB Push a file to your Android device:
adb push <source-path> <target-path>
For example:
adb push /local/path/Reddit.apk /system/apps/
- Once you are done, you need to remount with the system partition back to Read-Only.
mount -o remount,ro /system
- Done!
Now you should have an idea of how to use the ADB Push and ADB Pull command to push and pull files to and from your Android device. If you have any doubts, let us know in the comments down below.
Hello Vishnu
Hope you can help me with your expertise.
Issue: I get this adb error when I do the “Build and Deploy Scenes” from Oculus menu in Unity.
I recently bought Quest 2 / VR device. I downloaded the latest Oculus Integration package, Oculus Integration for Unity – 20.1. When I transfer the Unity file using OVR Scene Quick Review, the first step “Build and Deploy App” goes thru successfully and I see “APK installed successfully” in Unity.
But when I do the next step of “Build and Deploy scenes”, it creates the scene bundles but fails to transfer it to Quest 2 and gives the following error –
Building scene bundles . . .
Deploying scene bundles to device . . .
Failed!
adb: error: failed to stat remote object ‘/sdcard/Android/data/com.VP.OQ_Terrain/cache/scenes/OVRMasterBundle’: No such file or directory
Thank you.
Hey Ravi!
I have not used Quest 2 but the error seems to be pretty straight-forward. Seems like the command is looking for a file (in the location mentioned in the error message) but it is missing. Please make sure the expected file is in the expected location. That should fix this issue.