Push file to android

Push and Pull Files Using ADB Commands on Android

An advanced Android user always wants to minimize the work during the development process so that more focus can be beamed onto the target. ADB or Android Debug Bridge is a great tool for those who want to perform tasks on Android via computer. You can, for example, push and pull files using ADB push and ADB pull commands on any Android device.

During the development of a ROM or a Mod, many tiny operations like retrieving files from the device, flashing the mods, restore the backups if the device is bricked and so on. These tiny operations consume a major chunk of time during this process, and one most important operation is the pushing files to and pulling files from an Android device.

Transferring the APK’s and other files in and out using the normal process where you need to transfer the files using a USB cable and then using the root explorer to copy it to the system partition and then assigning permissions is a lengthy and tiresome process. Even if you make flashable Zips which can be flashed using recovery, you need to reboot to recovery every time you want to try the modification. The ADB method is the easiest way to transfer files from your computer to phone using ADB Push command, and pull the files from your Android device to your computer using ADB Pull command.

Using the ADB tool, you can push and pull files with simple commands, so you don’t even need to touch your device while trying your mods. Today, we will show you how to push and pull files on an Android device using the ADB commands. Recently, we compiled a huge list of ADB and Fastboot commands that can be helpful to you in doing amazing things on your Android phone or tablet.

Prepare Your Device

  • Charge your device above 60% battery level to avoid shutdowns during the process.
  • Install proper device drivers on your PC and check if the device is detected. You can find the USB drivers for your device from our drivers downloads page.
  • Enable USB Debugging on your phone from Settings> Developer options. If you do not find Developer option under device settings, read the instructions given here.
  • Either setup ADB and Fastboot on your computer, or download the Minimal Fastboot/ADB tool and unzip it: adb-platform-tools.zip

Push and Pull Files Using ADB Commands

  1. Download and extract the platform-tools.zip on your Windows, Mac, or Linux computer.
  2. Open a command prompt in the ADB folder by right-clicking on the mouse in the empty space of the folder while holding the Shift key. Select ‘Open command window here‘ or ‘Open PowerShell window here‘ option. ADB SDK Platform-Tools Command Window
  3. Now to pull any file from your device, you need to know its path. Once you know the path of the file, enter the following command to pull the file.

For instance, let’s pull the Settings.apk which is located in the /System/app/ folder on your device.

  • The file will be pulled and saved in the ADB folder itself and you can see the transfer rate in the command prompt. adb-pull
  • Pulling any file from the device is easy but pushing files to the device needs permissions. You can push any file to the internal or external SD card without any issue, but when you’re pushing it to the System partitions you might get this error: adb-push-mount-error
  • So you need to mount the file system as Read-Write rather than Read-only, so execute the following commands one-by-one to mount the system writable:
  • Your device might prompt for root permissions when you type SU, grant them. You will get the following output if everything went right.: adb-mount-writable
  • Once you are done making changes, you should remount with the original Read-Only.
  • To push a file to the device, just type the following command:

    Читайте также:  Android как удалять смс

  • If the file is pushed correctly to your device, you’ll get a similar output on the command prompt: adb-push
  • So you now know how to push and pull files using the ADB commands. These commands are important yet simple, aren’t they?

    Leave your feedback in the comments section below.

    Источник

    Android 101: How to Transfer Files between PC and Android Devices using ADB Push and Pull Commands

    Transferring files from/to Android devices is as easy as 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 commands come into play. In this guide, we will show you how to transfer files between PC and Android devices using ADB Push/Pull commands.

    ADB (Android Debug Bridge) is a versatile tool and a part of the Android SDK platform-tools package which is often used by Android developers, or enthusiasts who would like to tinker with the software. But it 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 be used to copy files from your PC to your Android device (or vice-versa) by just using a command.

    Usage of ADB Push & Pull Commands

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

    1. 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 don’t have the appropriate USB drivers installed. But what if you do have them installed and your PC still doesn’t detect the phone. Chances are your PC can still recognize your phone over ADB and if that’s the case, then you 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. But it makes sense to be acquainted with these commands just in case you might need them.

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

    Let’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 partition/internal storage. You’d realize that the flashable ZIP of the custom ROM that you transferred has been erased (Don’t worry, it happens to the best of us). In such a case, you can just connect your Android device to the PC and use the ADB Push command to copy files from your PC to your device.

    Sometimes, TWRP cannot even decrypt the data partition, which means you could not access your phone’s internal storage to flash ZIP files. This is quite common with newer Android devices running the latest Android version (Like on a Pixel 3 XL running Android 10). TWRP for your specific device could still be in development. But that shouldn’t stop you from flashing files either. So, you can use the ADB Push command to transfer zip files to a temporary directory (/tmp/*) and flash it right from there.

    Читайте также:  Lego dc mighty micros android

    Another situation is while you’re installing Magisk on your device, in where you patch the stock boot image using Magisk. Now before you can flash the patched boot 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 can use the command to pull the patched boot image from the device to the PC.

    3. For Android App and ROM Developers

    Developers often go through cycles of testing and debugging during the development process, and also after it, to iron out bugs/issues. And ADB is probably their best friend, which not only helps them in debugging but also makes the process much easy. If you’re a developer, then you can use ADB commands to push or pull files like logs, reports, or APKs to or from your Android devices pretty quickly.

    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.

    Preparations

    If you’re a developer or someone who often keeps fiddling with your Android phone’s software, you might already have everything set up and ready-to-use on your PC. But if you’re new, then you must first prepare both your PC and your Android device before you can start transferring files using ADB Push/Pull commands.

    • First of all, you must install ADB on your Windows, macOS, Linux PC.
    • Launch the command-line window in the same folder where ADB has been installed. To do so:
      • On Windows: Go the folder where ADB has been installed (e.g. C:\platform-tools). While holding the SHIFT key, right-click on any empty space inside the folder. Then select the “Open PowerShell window here” or “Open command window here” option.
      • On macOS/Linux: Launch the Terminal and change its directory to the folder where ADB has been installed (e.g. Documents/platform-tools/) using the cd command:

    • Optionally, you can also configure ADB to be used from any directory on the PC using the instructions here.
  • Next, enable USB debugging switch on your Android device.
  • Once you have done the above, head 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 understand their usage.

    Using ADB Push 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 want 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 following command:

    ⇒ “ ” is the full path to the file on the PC
    ⇒ “ ” is the path of location on the Android device where you want to transfer the file

  • Hit ‘Enter’ on the keyboard to execute the command
  • The progress of the transfer will be shown in the command-line window
  • Once 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 cable
    2. Launch the command-line window in the folder on the PC where ADB is installed
    3. Now type the following command:

    ⇒ “ ” is the full path to the file on your Android device
    ⇒ “ ” is the path of location on the PC where you want to transfer the file

  • Hit ‘Enter’ on the keyboard to execute the command
  • The progress of the transfer will be shown in the command-line window
  • 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 you how the ADB Push and ADB Pull commands exactly work, along with an example for each.

    Like I mentioned above, these commands aren’t something that a normal day-to-day Android user would need. But it’s good to know that you have them as an option when everything else fails. For developers and power-users who constantly work with ADB, these commands can come in really 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 set up on your PC, which is quite obvious since you are going to use ADB commands. Next, you have to enable Developer Options on your Android device and further enable the USB Debugging option within it. The options are hidden by-default as an extra layer of security, so that a normal user may not end up messing with them without any prior knowledge.

    Do note that USB Debugging only needs to be enabled to successfully interact with your device over ADB, when the device is booted into the actual OS. If you’re going to use the commands while your Android device is in TWRP recovery mode, then you do not need to enable USB Debugging.

    • Note: Please stray away from online resources which might tell you that USB debugging must be enabled in order to use ADB commands while in recovery mode (stock or custom, it 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). Make sure that you open the command-line in the same folder where the ADB tool is installed (not needed if ADB is configured to be used system-wide). After that, you just have to enter the commands. Read below for further explanation along with the example.

    1. Example of using ADB Push

    Now, the command to push a file from PC to Android device should start with “adb push”, followed by a space and the full path to the location of the file on the PC (referred as “ ” in the instructions above) that you want to transfer. After that, you have to add another space and enter the path to the location on the device where you want to transfer the file (referred to as “ ” in the instructions above).

    For example: Let’s 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 case, the command should look like the following:

    ⇒ Here “C:\platform-tools\ota.zip” is the full path of the file that I want to transfer from the PC. And, “/sdcard/Download” is the location on the device where I want 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 “ ” in the instructions) that you want to transfer. After that, you have to add another space and enter the path to the location on the PC where you want to transfer the file (referred to as “

    Источник

    Читайте также:  Adventure island для android
    Оцените статью