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

AndroidAdb

Android Problem Overview


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).

Android Solutions


Solution 1 - Android

From Ubuntu Terminal, below works for me.

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

Solution 2 - Android

I did it using this command:

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

example: adb push UPDATE-SuperSU-v2.01.zip /sdcard/0/

Solution 3 - Android

Follow these steps :

go to Android Sdk then 'platform-tools' path on your Terminal or Console

(on mac, default path is : /Users/USERNAME/Library/Android/sdk/platform-tools)

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

    1. ./adb shell (hit return/enter)
    1. 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

    1. cd /storage (hit return/enter)
    1. ls (hit return/enter)

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

    1. exit (hit return/enter)

to come out of adb shell

    1. ./adb push '/Users/SML/Documents/filename.zip' /storage/sdcard0/path_to_store/ (hit return/enter)

to copy file

Solution 4 - Android

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

Solution 5 - Android

Sometimes you need the extension,

> adb push file.zip /sdcard/file.zip

Solution 6 - Android

Try this to push in Internal storage.

adb push my-file.apk ./storage/emulated/0/

Works in One plus device, without SD card.

Solution 7 - Android

After Trying all the answers this worked for me

Where I am Pushing a file on Desktop to Android Device (Redmi K20 pro) connected Over the air using adb.

This command pushes the file to the downloads folder on my phone

adb push ~/Desktop/notifications.drawio ./storage/emulated/0/Download

after running this if you get a permission denied error

try running these commands in order (which basically changes the directory permission)

adb shell

chmod 777 /data/local/tmp

exit

and then run try the adb push command

I have documented this here feel free to share your views and help improve it.

Solution 8 - Android

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" />

Solution 9 - Android

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

Solution 10 - Android

As there are different paths for different versions. Here is a generic solution:

Find the path...

  1. Enter adb shell in command line.
  2. Then ls and Enter.

Now you'll see the files and directories of Android device. Now with combination of ls and cd dirName find the path to the Internal or External storage.

In the root directory, the directories names will be like mnt, sdcard, emulator0, etc

Example: adb push file.txt mnt/sdcard/myDir/Projects/

Solution 11 - Android

This might be the best answer you'll may read. Setup Android Studio Then just go to view & Open Device Explorer. Right-click on the folder & just upload a file.

Solution 12 - Android

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..

Solution 13 - Android

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 )

Solution 14 - Android

In my case, I had an already removed SDCard still registered in Android. So I longpressed the entry for my old SDCard under:

Settings | Storage & USB

and selected "Forget".

Afterwards a normal

adb push myfile.zip /sdcard/

worked fine.

Solution 15 - Android

In Mac: To push files via adb

adb push /Users/Downloads⁩/amazon.sdktester.json '/mnt/sdcard/amazon.sdktester.json'

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNikhil KumarView Question on Stackoverflow
Solution 1 - AndroidHardik TrivediView Answer on Stackoverflow
Solution 2 - AndroidvincsilverView Answer on Stackoverflow
Solution 3 - AndroidSMLView Answer on Stackoverflow
Solution 4 - AndroidRocky ChenView Answer on Stackoverflow
Solution 5 - AndroidJonas BorggrenView Answer on Stackoverflow
Solution 6 - AndroidNaitik SoniView Answer on Stackoverflow
Solution 7 - AndroidMahesh JamdadeView Answer on Stackoverflow
Solution 8 - AndroidAlexView Answer on Stackoverflow
Solution 9 - AndroidMaik93View Answer on Stackoverflow
Solution 10 - AndroidM. Usman KhanView Answer on Stackoverflow
Solution 11 - AndroidRushabh GedamView Answer on Stackoverflow
Solution 12 - Androiduser3555061View Answer on Stackoverflow
Solution 13 - AndroidsolverView Answer on Stackoverflow
Solution 14 - AndroidDirkView Answer on Stackoverflow
Solution 15 - AndroidAbhishek DongleView Answer on Stackoverflow