Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android emulator "adb push" not working (No such file or directory)

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 #

like image 953
ainos984 Avatar asked Dec 06 '22 23:12

ainos984


2 Answers

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.

like image 51
ainos984 Avatar answered Dec 10 '22 12:12

ainos984


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'
like image 27
Mohammad Rahchamani Avatar answered Dec 10 '22 11:12

Mohammad Rahchamani