Skip to content Skip to sidebar Skip to footer

Use Adb to Upload File to Phone

Transferring files from/to Android devices is as easy equally plugging the USB cable and turning on MTP/File Transfer mode. But what if the option isn't available in a given situation?

That's where the ADB Pull and ADB Push button commands come into play. In this guide, we volition show you how to transfer files between PC and Android devices using ADB Push/Pull commands.

ADB (Android Debug Span) is a versatile tool and a office of the Android SDK platform-tools package which is oft used by Android developers, or enthusiasts who would like to tinker with the software. But information technology also offers features that could come in handy to an average user too. The Pull and Push commands of ADB are one of them and could exist used to copy files from your PC to your Android device (or vice-versa) by just using a command.

Table of Contents
  • Usage of ADB Push & Pull Commands
  • Preparations
  • Using ADB Button to Transfer Files from PC to Android Device
  • Using ADB Pull to Transfer Files from Android Device to PC
  • Caption
    • 1. Case of using ADB Button
    • two. Example of using ADB Pull

Usage of ADB Push & Pull Commands

When would you need to use ADB Push/Pull Commands

So when would you demand to use ADB Button and ADB pull commands to transfer files to and from your Android device? There are quite a few situations where ADB Pull/Push button can make things easier for you and even get you out of tricky situations. Nosotros take discussed some of these situations below.

i. For an average user

If your PC cannot recognize your Android phone even after enabling MTP/File Transfer mode. Yes, this could certainly mean that you lot don't have the appropriate USB drivers installed. But what if yous practice have them installed and your PC still doesn't discover the phone. Chances are your PC can however recognize your phone over ADB and if that's the case, then y'all can use the commands to transfer files. Note: This is not the ultimate solution, you'd still need to troubleshoot your PC and resolve the issue.

Basically, using ADB Push and Pull commands isn't something that an average Android user might need. Merely it makes sense to be acquainted with these commands simply in case y'all might need them.

2. For an Android enthusiast (a.k.a flashaholic)

Permit's say you're in the midst of flashing a custom ROM which requires you to wipe the OS in TWRP, sometimes even the data sectionalization/internal storage. You'd realize that the flashable Nil of the custom ROM that you transferred has been erased (Don't worry, information technology happens to the best of us). In such a instance, you can simply connect your Android device to the PC and use the ADB Push control to copy files from your PC to your device.

Sometimes, TWRP cannot even decrypt the data partition, which means you could not admission your phone's internal storage to flash Null files. This is quite common with newer Android devices running the latest Android version (Similar on a Pixel three XL running Android x). TWRP for your specific device could still be in evolution. But that shouldn't stop you from flashing files either. So, you can apply the ADB Push command to transfer zip files to a temporary directory (/tmp/*) and flash it right from at that place.

Another situation is while you're installing Magisk on your device, in where you lot patch the stock boot prototype using Magisk. Now before you can flash the patched kicking image to your device, you must first transfer it from your device's storage to the PC. This is when the ADB Pull command can specifically be helpful. You tin use the command to pull the patched kicking epitome from the device to the PC.

three. For Android App and ROM Developers

Developers often go through cycles of testing and debugging during the evolution process, and likewise afterward information technology, to iron out bugs/bug. And ADB is probably their best friend, which not only helps them in debugging but also makes the process much easy. If y'all're a developer, then you lot tin can use ADB commands to push or pull files similar logs, reports, or APKs to or from your Android devices pretty apace.

Now that you know when you might need to use the ADB Push and ADB Pull commands, let's get to the instructions on how to use them to transfer files.

How to Use ADB Push/ADB Pull Commands to Transfer Files Between PC and Android

Preparations

If y'all're a developer or someone who often keeps niggling with your Android phone's software, you might already take everything set and set-to-utilise on your PC. But if you're new, and then you must first set both your PC and your Android device before you can start transferring files using ADB Push button/Pull commands.

  • First of all, you must install ADB on your Windows, macOS, Linux PC.
  • Launch the command-line window in the aforementioned binder where ADB has been installed. To do so:
    • On Windows: Become the folder where ADB has been installed (due east.g. C:\platform-tools). While holding the SHIFT key, right-click on any empty infinite within the binder. Then select the "Open PowerShell window here" or "Open command window here" selection.
      How to Use ADB Push/Pull Commands - Open PowerShell in Windows
    • On macOS/Linux: Launch the Terminal and alter its directory to the folder where ADB has been installed (due east.g. Documents/platform-tools/) using the cd control:
      cd Documents/platform-tools

      How to Use ADB Push/Pull Commands - cd to platform-tools folder in Terminal

    • Optionally, you tin also configure ADB to be used from any directory on the PC using the instructions here.
  • Adjacent, enable USB debugging switch on your Android device.

Once you have done the higher up, caput down below to the instructions on how to transfer files between your PC and Android device using ADB Push and ADB Pull commands. Make sure that you go through the steps and then read the explanation thereafter to fully empathize their usage.

Using ADB Button to Transfer Files from PC to Android Device

  1. Connect your Android device to the PC using a USB cable
  2. Copy the file (ZIP, APK, etc) that you desire to transfer to the folder where ADB is installed on PC
  3. Launch the Command Prompt/PowerShell or Terminal in the same folder
  4. Now type the post-obit command:
    adb push <local file> <remote location>

    ⇒ "<local file>" is the full path to the file on the PC
    ⇒ "<remote location>" is the path of location on the Android device where you desire to transfer the file

  5. Hit 'Enter' on the keyboard to execute the command
  6. The progress of the transfer volition exist shown in the command-line window
  7. One time the file has been transferred, disconnect the Android device from the PC

Using ADB Pull to Transfer Files from Android Device to PC

  1. Connect your Android device to the PC using a USB cablevision
  2. Launch the command-line window in the folder on the PC where ADB is installed
  3. Now type the following command:
    adb push <remote file> <local location>

    ⇒ "<remote file>" is the total path to the file on your Android device
    ⇒ "<local location>" is the path of location on the PC where you want to transfer the file

  4. Hit 'Enter' on the keyboard to execute the command
  5. The progress of the transfer volition exist shown in the command-line window
  6. Once the file has been transferred, disconnect the Android device from the PC

Explanation

Now, the instructions above offered you the syntax of using the commands. Now, let's show yous how the ADB Button and ADB Pull commands exactly work, along with an instance for each.

Like I mentioned above, these commands aren't something that a normal day-to-day Android user would demand. Only it'due south good to know that you accept them as an option when everything else fails. For developers and power-users who constantly piece of work with ADB, these commands can come in actually handy and takes out the extra effort of enabling MTP/File Transfer mode and then moving the files.

So, to start off, you have to make sure that ADB is properly ready upward on your PC, which is quite obvious since yous are going to apply ADB commands. Side by side, you have to enable Programmer Options on your Android device and further enable the USB Debugging pick inside it. The options are hidden by-default as an extra layer of security, and so that a normal user may not end upward messing with them without whatever prior noesis.

Practice note that USB Debugging only needs to be enabled to successfully collaborate with your device over ADB, when the device is booted into the actual OS. If y'all're going to employ the commands while your Android device is in TWRP recovery mode, then y'all practise non need to enable USB Debugging.

  • Note: Please stray away from online resource which might tell you lot that USB debugging must be enabled in guild to utilise ADB commands while in recovery manner (stock or custom, information technology doesn't matter).

Once that is done, you just have to connect the device to the PC using the USB cable and launch the command-line window (PowerShell/CMD in Windows, or Terminal in macOS/Linux). Brand certain that yous open up the control-line in the same folder where the ADB tool is installed (not needed if ADB is configured to be used organization-wide). After that, you just have to enter the commands. Read below for further explanation forth with the example.

ane. Example of using ADB Push button

Now, the control to push a file from PC to Android device should starting time with "adb push", followed by a space and the full path to the location of the file on the PC (referred equally "<local file>" in the instructions in a higher place) that y'all want to transfer. After that, you have to add another space and enter the path to the location on the device where yous want to transfer the file (referred to equally "<remote location>" in the instructions in a higher place).

Example of how to use ADB Push Command to Transfer File from PC to Android

For example: Permit'due south say I want to push a file named "ota.zip" located in the "C:\platform-tools" folder on my PC to the "Download" folder of my device's internal storage. In that example, the control should look like the following:

adb push C:\platform-tools\ota.zilch /sdcard/Download

⇒ Here "C:\platform-tools\ota.null" is the full path of the file that I desire to transfer from the PC. And, "/sdcard/Download" is the location on the device where I desire to transfer the file.

2. Example of using ADB Pull

On the other hand, the command to pull/copy a file from Android to PC should start with "adb pull", followed by a space and the full path to the location of the file on the device (referred to as "<remote file>" in the instructions) that you want to transfer. After that, you have to add together another infinite and enter the path to the location on the PC where yous want to transfer the file (referred to as "<local location" in the instructions in a higher place).

Example of how to use ADB Pull Command to Transfer File from Android to PC

For example: If y'all want to pull a file named "magisk_patched.img" located in the "Download" folder of my device's internal storage, to the "C:\platform-tools" folder on my PC, and so the command should look like the following:

adb pull /sdcard/Download/magisk_patched.img C:\platform-tools

⇒ Here, Here "/sdcard/Download/magisk_patched.img" is the full path of the file that I want to transfer from the device. And, "C:\platform-tools" is the location on the PC where I desire to transfer the file.

We hope the examples have given you lot a clear idea of how the commands work. If you nonetheless experience confused, you should give it a try and it won't do whatever harm. If you lot input a incorrect command, the command-line will instantly show an mistake message. If you enter the correct path and the command is successful, then you should transfer progress in the command-line itself.

And then that's how you tin can utilise ADB Push button/Pull commands to transfer files between your PC and Android device.

This is one of the many articles in our Android 101 series, where nosotros teach you the basics of Android. We hope you observe this commodity and the whole series useful. If yous have whatever questions regarding the ADB Push button and ADB Pull commands or their usage, please let us know via the comments.

davispaten1985.blogspot.com

Source: https://www.thecustomdroid.com/adb-push-pull-commands/

Enregistrer un commentaire for "Use Adb to Upload File to Phone"