Search code examples
androidadb

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


How to push a file from computer to an 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 a 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:

3399 KB/s (111387 bytes in 0.032s).

Solution

  • From Ubuntu/Mac Terminal, the below command should work.

    ./adb push '/home/hardik.trivedi/Downloads/one.jpg' '/data/local/'
    

    For adb v33 and above if you are getting a permission denied error, try what I tried. The following command and it works fine. The only caveat is you might need to use tmp directory on such an emulator.

    adb shell #Entering into shell
    su #Super user mode
    chmod 777 /data/local/tmp/ #Granting RWX access
    exit
    chmod 777 /data/local/tmp/ #Granting RWX access
    exit
    

    And then try

    ./adb push '/home/hardik.trivedi/Downloads/one.jpg' '/data/local/tmp/'