4

I'd like to open local web pages on an android emulator, so I created an emulator API 14 (Android 4.0) and I launched it from the AVD manager. Next step: move my files from pc to emulator and open it in a browser. That's the problem...

I'm trying the following commands:

adb push C:\My\local\directory sdcard
adb push C:\My\local\directory /sdcard
adb push C:\My\local\directory /mnt/sdcard
adb push C:\My\local\directory /storage/sdcard

The result is always the same:

push: C:\My\local\directory/subdirectory/file2.txt -> sdcard/subdirectory/file2.txt
failed to copy 'C:\My\local\directory/subdirectory/file2.txt' to 'sdcard/subdirectory/file2.txt': No such file or directory

If I run the shell I can see the sdcard folder:

C:\Users\me\Desktop\and-s-ws\sdk\platform-tools>adb shell
# ls
ls
acct
cache
config
d
data
default.prop
dev
etc
init
init.goldfish.rc
init.rc
mnt
proc
root
sbin
sdcard
sys
system
ueventd.goldfish.rc
ueventd.rc
vendor

# cd sdcard
cd sdcard
# ls
ls

Any help? Thanks #

ainos984
  • 459
  • 1
  • 7
  • 17
  • run `adb -h` and search for `adb push` under the section "device commands" , is it exists ? – Muhammed Refaat Nov 24 '14 at 12:05
  • possible duplicate of [android: Recursive copy with adb push](http://stackoverflow.com/questions/13145872/android-recursive-copy-with-adb-push) – ben75 Nov 24 '14 at 12:15
  • @ben75 I understand you markdown but this is not an obvious duplicate, I couldn't find that question because title seems so different from my problem; they only have the same solutions, but not the same origin. So sorry for this downvote... – ainos984 Nov 24 '14 at 13:29
  • @ainos984 I didn't downvote :-) just vote to close as duplicate (does it solve your problem ? ) – ben75 Nov 24 '14 at 14:26
  • @ben75 yes, it solved my problem (or better, I understood there isn't a straightforward solution for the error) but the questions are different so I don't think is a duplicate case. Don't you think too? However, doesn't matter. I understood my problem that's the point of all :-) – ainos984 Nov 24 '14 at 14:54
  • try this: https://stackoverflow.com/a/70375963/10046475 – aris Dec 16 '21 at 08:38
  • adb push yourFile.xml \C:\Users\yourUN\.android\avd\Pixel_4_API_29.avd\mnt\sdcard – aris Dec 16 '21 at 08:39

4 Answers4

12

Finally I understood the problem was the sdcard permissions. I changed the read-write permissions following this steps in the adb shell:

https://stackoverflow.com/a/19221592/2090803

After that, the adb push command worked fine:

adb push C:\My\local\directory /sdcard/myFolder

The adb automatically created the new folder myFolder and pushed correctly the directory and all the subdirectories and files.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
ainos984
  • 459
  • 1
  • 7
  • 17
4

I think the problem is destination path. you should add / to beginning of your destination path. Try this:

adb push  C:\My\local\directory\file.txt '/sdcard/path'
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Mohammad Rahchamani
  • 5,002
  • 1
  • 26
  • 36
0

I think the problem is the folder structure. The folders have to be there before you start to copy because adb can't create them.

  • No it wasn't. As you can see in my answer, the problem was the read-write permission on the sdcard folder. Thanks anyway. – ainos984 Feb 04 '15 at 17:06
0

try this it worked for me:

adb push "local path" sdcard/
DoctorWho
  • 1,044
  • 11
  • 34
Virluz
  • 469
  • 3
  • 6