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
My solution (example with a random mp4 video file):
Set a file to device:
adb push /home/myuser/myVideoFile.mp4 /storage/emulated/legacy/
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" />
As there are different paths for different versions. Here is a generic solution:
Find the path...
adb shell
in command line.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/
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.
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
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 :
now you will see the list of Directories and files from your android device there you may find /sdcard as well as /storage
you may see sdcard0 (generally sdcard0 is internal storage) and sdcard1 (if External SDCard is present)
to come out of adb shell
to copy file
I did it using this command:
syntax: adb push filename.extension /sdcard/0/
example: adb push UPDATE-SuperSU-v2.01.zip /sdcard/0/