Learn how you can push and pull files in your Android Device using ADB Push and Pull Commands.
An adept Android user always looks at minimizing the work during the process of development so as to achieve the target quickly.
Android Debug Bridge also known as ADB is a flexible tool which is a part of the Android SDK platform and frequently used by Android developers while developing. It facilitates a range of device actions like installing and debugging apps along with transferring or copying files. ADB can be downloaded with the SDK manager. It will be installed at android_sdk/platform-tools.
Components of ADB
ADB has three components namely client, server and daemon. The computer is the client to which your android device is connected. Daemon is a service which runs both in the computer and in android device. The daemon also executes commands. The server manages the communication between the client and the daemon.
ADB tracks all android devices running or connected to a host developer machine.
ADB allows you to modify your device through a PC command line.
Control commands are also implemented by ADB for the benefit of the client.
Not only the developer, ADB is also helpful to the user as it has features such as ADB Push and pull which helps in copying files from your Android phone to the computer, as well as from the computer to your device using just a command.
ADB Push and Pull Use Cases
There are many instances where push and pull help to transfer the files. Mentioned below are some scenarios where the commands are used.
- For an Android developer.
Let’s say the developer is developing a ROM. During the development process, small operations such as file retrievals and mod flashing take away a major amount of the time. Pulling and pushing files from an Android device is an important operation.
Transferring the files and APK’S using the normal process by connecting the USB cable to the system is a laborious method which involves assigning permissions and using the root explorer to copy the files to the system partition. Using flashable zips for recovery is also not feasible as rebooting to recovery is necessary for each modification. ADB is the ideal way to transfer the files from system to the android device using the ADB push command. The files can be pulled to system from the device using the ADB pull command.
ADB is the best buddy of the developer as it helps iron out the issues and makes development process smoother. It acts as a bridge for developers to work out.
- For an Android user
It’s not necessary for the user to mandatorily know the push and pull commands but if the system does not recognize and detect your device, then these commands will be helpful to transfer or copy the files from device to the system
How to use ADB Push and Pull
The procedure for ADB push is mentioned herewith.
- Make sure the device is charged to more than 60% battery to prevent a shutdown in the middle of the procedure.
- Ensure that proper device drivers are installed so that the device can be detected easily.
- On your phone, enable USB debugging under Settings >Developer options.
Please note that developer options might be named or located differently in some devices.
- Download the ADB tool and unzip it with the command adb-platformtools.zip or set up ADB on your computer.
Pulling the files from device to system
Follow the below steps for pulling the files
- Using USB cable, connect device to the system .
- Check the folder where ADB is installed and launch the command in line window in that folder on the PC.
- To pull any file, you have to know the path. Once the path is known , enter the following command
adbpull < path- of- the file >
if you want to pull settings file, then command will be adb/pull /system/app /settings
On entering this command, file will be saved in ADB folder.
Pushing the files to device from system
Pushing the files is harder than pulling as it involves more permissions. You might face issues while pushing the files to system partition. An error message that the file is read only will be displayed. In this case, you need to mount file as read and write rather than read only. Enter the following command
mount -o remount, rw /system
The command su might ask for root permission. Grant the root permission. Now if everything has gone right, you will get the correct output
Once you have made the necessary changes, remount to read only.
Enter the following command to push a file
adbpush < source-path ><target >
So if you want to push the settings file,
adbpush < settings.apk / system
If the file is pushed correctly, correct output will be displayed in the command prompt.
The above process shows how to push and pull the files in a simple way.