how to use adb command to push a file on device without sd card

How to push a file from computer to a android device having no SD Card in it. I tried:

C:\anand>adb push anand.jpg /data/local
3399 KB/s (111387 bytes in 0.032s)

C:\anand>adb push anand.jpg /data/opt
3199 KB/s (111387 bytes in 0.034s)

C:\anand>adb push anand.jpg /data/tmp
3884 KB/s (111387 bytes in 0.028s)

above commands to move a file anand.jpg to device but I didn’t get this jpg file in the device.
I didn’t get any success result on cmd prompt, I only got:

  • How to find the UUID of serial port Bluetooth device?
  • Put and get String array from shared preferences
  • How to add space to AutoCompleteTextView suggestion
  • How do I test the home button on the Action Bar with Espresso?
  • Custom animation in Android
  • How to handle hardware search button android?
  • 3399 KB/s (111387 bytes in 0.032s).

    Related posts:

    Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras?
    Android: Forcing external microphone (jack input 3.5mm) to stay on
    Eclipse debugger stops by itself without any throwable
    Why can't I set text to an Android TextView?
    Picasso library stopped working today with facebook graph picture links
    FloatingActionButton class could not be instantiated
  • Add a Textview to a FrameLayout in a determined position
  • Join 3 tables in SQLite database
  • Is there Android Intent concept in iPhone SDK
  • How to grant permission for application which is downloaded from play store?
  • How to zoom a textview in android?
  • Android - OnDateChangedListener - how do you set this?
  • 9 Solutions collect form web for “how to use adb command to push a file on device without sd card”

    From Ubuntu Terminal, below works for me.

    ./adb push '/home/webonise/Downloads/one.jpg' '/data/local/'

    I did it using this command:

    syntax: adb push filename.extnsion /sdcard/0/

    example: adb push /sdcard/0/

    Follow these steps :

    go to Android Sdk then ‘platform-tools’ path on your Terminal or Console:

    To check the SDCards(External and Internal) installed on your device fire these commands :

    • 1) ./adb shell (hit return/enter)
    • 2) cd -(hit return/enter)

    now you will see the list of Directories and files from your android device
    there you may find /sdcard as well as /storage

    • 3) cd /storage (hit return/enter)
    • 4) ls (hit return/enter)

    you may see sdcard0 (generally sdcard0 is internal storage) and sdcard1 (if External SDCard is present)

    • 5) exit (hit return/enter)

    to come out of adb shell

    • 6) ./adb push ‘/Users/SML/Documents/’
      (hit return/enter)

    to copy file

    Sometimes you need the extension,

    adb push /sdcard/

    run below command firstly

    adb root
    adb remount

    Then execute what you input previously

    C:\anand>adb push anand.jpg /data/local
    C:\anand>adb push anand.jpg /data/opt
    C:\anand>adb push anand.jpg /data/tmp

    I’ve got a Nexus 4, that is without external storage. However Android thinks to have one because it mount a separated partition called “storage”, mounted in “/storage/emulated/legacy”, so try pushing there: adb push anand.jpg /storage/emulated/legacy

    My solution (example with a random mp4 video file):

    1. Set a file to device:

      adb push /home/myuser/myVideoFile.mp4 /storage/emulated/legacy/
    2. Get a file from device:

      adb pull /storage/emulated/legacy/myVideoFile.mp4 

    For retrieve the path in the code:

    String myFilePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/myVideoFile.mp4";

    This is all. This solution doesn’t give permission problems and it works fine.

    Last point: I wanted to change the video metadata information. If you want to write into your device you should change the permission in the AndroidManifest.xml. Add this line:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    You are trying to write to system folders. With ADB you have root (admin) access so you see the system folders of which sdcard is one of them so to send a picture you could use

    D:\Program Files\Android\sdk\platform-tools\adb push am files\android sdk\adb.exe push C:\Downloads\anand.jpg /sdcard/pictures/

    NB: C:\Downloads\anand.jpg replace with path and name to picture..

    Certain versions of android do not fire proper tasks for updating the state of file system.
    You could trigger an explicit intent for updating the status of the file system.
    (I just tested after being in the same OP’s situation)

    adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///

    (You could pass a specific filepath instead of file:/// like file:///sdcard )

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.