This question already has answers here:
Android+Eclipse: Can't push files to SD Card [duplicate]
(7 answers)
Closed 9 years ago.
I am using windows vista on which I installed android. I created an sd card file(.img extension). When I tried to push a file to it through ddms, it showed that 'Failed to push' . Also I could see that the permission parameter was set as d-----. How to reslove this issue. Thanks in advance
Once you started the Emulator from one shell, login to another shell & type
adb shell
You should see # prompt displayed, this is your device(emulator) shell. Now , type following command at adb shell.
mount -o remount rw /sdcard
This will now remount /sdcard with rw(read-write) permission & now you can push your files into /sdcard by using following command from your host shell.
adb push filename.mp3 /sdcard, where filename.mp3 could be any file that you want to push into Android Emulator.
Related
This question already has answers here:
Android: adb pull file on desktop
(6 answers)
Closed 4 years ago.
Android: adb pull file on desktop
Trying to copy file from remote device to desktop, here is a command:
adb -s xx.xx.xx.xx:5555 pull sdcard/screen.png c:/users/xx/desktop/
But I always get the message:
cannot create 'c:\users\xx\desktop\': No such file or directory!! | in sdcard
if i run the same command whitout dir path
adb pull <remote> [local]
adb -s xx.xx.xx.xx:5555 pull sdcard/log.txt log1.txt
it well copy file screen.png to the same android sdcard dir not sdk folder in my windows Os
do adb has the ability to transfer file over tcp/ip like the documentation (adb pull <remote> [local]) or im wrong ??
If I am not wrong, "/" is for defining path in Unix systems. Try to use "\" as Windows systems define path.
I want to push some apk file to sd card, then to /system folder. I tried the following commands in order:
adb shell
su
mount -o rw,remount /system
adb push /data/app/com.project.android.xxx-2.apk /sdcard
But the last line always results in device not found error. I have even tried with system folder directly as, adb push /data/app/com.project.android.xxx-2.apk /system/app, but it gave me the same error. I have also tried to execute this line before push command:
chmod 644 /sdcard
But that didn't solve the push command problem.
My device is rooted.
Device driver is updated.
My device has sd card.
USB debugging mode is enabled.
When I write adb devices I get my device name.
What is causing this error, and how can I solve it?
You're executing adb push being already shell-ed into the device. By doing that you start another adb server on the target device now (not on your host machine), which is scanning ports in some range looking for devices attached. Since no device is found (attached to the target device) you get error: device not found. For the kind of task you're trying to achieve no need to use any of adb commands within shell.
Try either mv or cp command once you shell-ed in. For example (remounting part skipped):
adb shell
cp /data/app/com.project.android.xxx-2.apk /sdcard
This question already has answers here:
Ship an application with a database
(15 answers)
Closed 7 years ago.
I'm generating a sqlite database on my desktop system, this database (file with .db extention) should be pushed to my Android app by USB cable.
Is it possible?
If yes, how?
Short answer on your question is Yes and No.
Yes - if your device is coming with android version 4.3 and below and in every case if your device is rooted. (I will explain procedure below for non-rooted and android <=4.3);
No - if your device is not rooted and android version is 4.4 and higher.
Assuming that your device is not rooted and version of android is 4.3 and minor, you have to perform next actions:
Changing permissions on current db:
adb shell
$ run-as your.package.name
$ cd ./databases/
$ chmod 666 ./dbname.db
$ exit
$ exit
Backing up the original db:
adb pull /data/data/your.package.name/databases/dbname.db /your/path/to/file/on/computer
Replacing current with new database:
adb push /your/path/to/file/on/computer/dbname.db /data/data/your.package.name/databases/dbname.db
Restoring original permissions:
adb shell
$ run-as package.name
$ chmod 660 ./databases/dbname.db #Restore original permissions
$ exit
$ exit
Also, note that you have to adapt paths and file names for your current situation.
If you have rooted phone, then you have to change permissions over su user. If you need that procedure, I can post it, also.
Try this: Using DDMS(Dalvik Debug Monitor Server )
My problem is i can write files on sd card in emulator but i find the solution to this problem in stack overflow here to implement that you have to add a group media_rw under android.permission.WRITE_EXTERNAL_STORAGE in platform.xml so for i successfully pulled the xml file but after editing the file i can't push that file so when i am pushing it gives the below error
[Java is awesome]:~$ adb push platform.xml /system/etc/permissions/
failed to copy 'platform.xml' to '/system/etc/permissions//platform.xml': Read-only file system
to overcome this i remount the adb and again i tried i gives the below error
[Java is awesome]:~$ adb remount
remount succeeded
[Java is awesome]:~$ adb push platform.xml /system/etc/permissions/
failed to copy 'platform.xml' to '/system/etc/permissions//platform.xml': Out of memory
so how can push the file or is there any alternative that can enable editing of file with in the adb shell
Thanks in advance
You need to increase the /system partition size accordingly to account for the extra bytes in the file:
You can do this with the following command:
emulator -partition-size <size>
Where is the size depends on your system image plus the extra bytes.
This question already has answers here:
where is my app? /data appears empty
(3 answers)
Closed 8 years ago.
I'm trying to access the sqlite database file on the device. I mean, I've launched the app on the device via adb. And now I wanto to download this file as I did before on emulator via DDMS. But when I select the device on DDMS and open the folder data, it is empty.
Is it the right way to do? Or there is another way to download this db file.
Thanks.
You can access to the data folder without root, provided the application is debuggable
<application
...
android:debuggable="true"
...
To list the base directory :
adb shell "run-as com.your.package ls -l"
To copy a file :
adb shell "run-as com.your.package cat relative/path > /sdcard/some_name"
adb pull /sdcard/some_name
Unfortunately pre-ICS run-as is quite buggy. The usual symptom is a
run-as: Package 'com.your.package' is unknown
message.
Have you tried adb directly?
adb pull /data/data/the.package.of.the.app/databases/the_name_of_the_database.db