I can use the file explorer fine with the emulator, but when I try to open directories with an actual device, it is unable to open the directory.
I have selected my device under the Devices tab, and I can see the directories under the file explorer tab.
If I try to used adb shell on the cmd line, I can see the directories but when I try to open them I get: "opendir failed, Permission denied"
the permissions on the directory are drwxrwx--x
I feel like there might be some permission setting on the device that I am overlooking, any ideas?
You cannot access most of the filesystem on production devices, except perhaps on rooted ones, by any means, let alone DDMS' file manager.
For your own app, you can use adb shell run-as to copy a file to external storage, then copy it off from there using DDMS' file manager, or adb pull, or just using your normal desktop OS to copy from the mounted storage.
Related
I was attempting to access the data data folder of an application without rooting . I followed How to access data/data folder in Android device? and was able to access the folder.
Now I was trying to copy the required file from data/data to a folder in my SD Card , however I get a permission denied on it. In the thread I have referenced above , no body complained of this behaviour so I suppose it shouldn't happen at my end too .
This is exactly what I am doing
C:\AndroidSdk\platform-tools>adb shell
shell#D6503:/ $ run-as com.xxx.xxx
run-as com.xxx.xxx
shell#D6503:/data/data/com.xxx.xxx $ cp databases/xxx.db /storage/sdcard1/Pictures/
cp: /storage/sdcard1/Pictures/xxx.db: Permission denied
I have verified that the folder /storage/sdcard1/Pictures is accessible through shell.
Happened to me as well. This is what I did to access the contents of the data folder of my app in my Nexus 5 (Android 5.0), without having root access or chmoding any file:
Open a console where your ADB is located and execute:
adb backup -noapk com.your.packagename
You will be asked to accept the backup on your device. Accept it and don't use any password. Once the backup process is completed, you will have a file with .ab extension on your ADB folder.
The backup will be compressed in a special way, you can decompress it with this tool: Android Backup Extractor
To use it, unzip it and put the backup file (*.ab) on the same folder where the extractor (abe.jar) is. Then open a console there and execute the following command:
java -jar abe.jar unpack NAME_OF_BACKUP.ab NAME_OF_BACKUP.tar
Notice that the result of this operation will be a *.tar file, which can be opened or decompressed with WinRAR or many other compression tools.
OPTIONAL for SQLite Databases: If you want to see the contents of the database, you can use this Firefox plug-in: Firefox SQLite Manager
I am trying to develop a simple pygame with Ubuntu Linux 11.10 for my Motorola android phone. I am having trouble getting the "adb push" command to work. I get an failed to copy 'foo.txt' to '/media/MOT': No such file or directory error message. What am I doing wrong?
Here is what I tried so far:
The phone's SD card is mounted at /media/MOT/ and I am able to ls, create a folder and delete a folder in it.
user#linuxlappy:~$
user#linuxlappy:~$ cd /media/MOT/
user#linuxlappy:/media/MOT$ ls
Android burstlyImageCache burstlyVideoCache data DCIM download gstomperdemo LOST.DIR slacker temp.apk
user#linuxlappy:/media/MOT$ mkdir writetest
user#linuxlappy:/media/MOT$ rmdir writetest/
The file that I am trying to copy is foo.txt in my /home/user/ directory
user#linuxlappy:/media/MOT$ cd /home/user/
user#linuxlappy:~$ ls foo.*
foo.txt foo.txt~
I enabled USB debugging on the phone with:
Settings > Applications > Development > USB debugging.
I believe I have adb installed correctly, I am able to list the phone with adb devices.
user#linuxlappy:~$ adb devices
List of devices attached
0910E8201700B017 device
When I try to push a simple text file to the SD card I get this error message.
user#linuxlappy:~$ adb push foo.txt /media/MOT
failed to copy 'foo.txt' to '/media/MOT': No such file or directory
user#linuxlappy:~$
The phone's SD card is mounted at /media/MOT/
Based on your terminal output, it is mounted on your desktop Linux environment as /media/MOT. In which case, to copy files to it, you use cp.
Using adb push, you need to use the path where the external storage resides on the phone. A common spot is /mnt/sdcard/, though it may vary. Also, bear in mind that, depending on your phone, external storage may not be available while you have it mounted as a volume on your desktop Linux environment.
I need to install an APK on a phone with no built in file browser, and no connection (wifi/mobile). The LG Optimus M has no built in file browser... Not sure why, but it is making things very difficult. I was thinking if I could put an app in a special place on an SD card, or auto-run an APK install.
ADB is also not an option due to usb driver issues. I know this is pretty limited...
EDIT: I got down voted because you didn't read? There is no wifi/mobile connection available. Downloading a file manager etc. from market not an option.
Enable usb debugging
Install the drivers and android sdk
Connect the phone through usb to your computer
Call the following program from the command prompt: adb install
application.apk
Adb will now install your application
According to the about of just running adb, you can use the following command line arguments:
adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
- push this package file to the device and install it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data)
('-s' means install on SD card instead of internal storage)
('--algo', '--key', and '--iv' mean the file is encrypted already)
Why not download one of the MANY file browsers in the market? May I suggest my favorite which is Astro File Manager
If you have a terminal emulator app on the device, you can put MyApp.apk on the SD card and run this, which should open the package installer:
am start -a "android.intent.action.VIEW" -d "file:///mnt/sdcard/external_sd/MyApp.apk" -t "application/vnd.android.package-archive"
You might need to change that path depending on your device — see How can I determine storage directory from ADB?
You will also need to enable the Unknown Sources option in the device settings.
Why not download astro file manager? it works great. Other than that I would host the apk on a server and download it from the phone.
Description
I'm trying to Push file (.so library) onto Android Device (Samsung NexusS) "system\lib" folder using Eclipse. But when I press "Push a file onto the device" an error appears:
[2011-06-24 15:41:21] Failed to push
selection: Read-only file system
Researches
To solve this problem I search through internet and find some articles and documentations, but nothing helps me, here are some articles and documentations which I have tried.
Read-Only File System" when trying to ADB Push an App
Here users suggest to write adb shell sysrw, but when I an permission denied error appeared:
sysrw: permission denied
Copying Files to or from an Emulator/Device Instance
Here on Android Developers Forum I found "You can use the adb commands pull and push to copy files to and from an emulator/device instance's data file. Unlike the install command, which only copies an .apk file to a specific location, the pull and push commands let you copy arbitrary directories and files to any location in an emulator/device instance."
I also try to run adb remount command, but same permission error appeared:
remount: permission denied
Question
How I can push file onto Android Device (NexusS) using eclipse or adb ?
Typically access to system folder requires root permission, so unless you have rooted your phone i.e. you have superuser permission its not possible to access system folder or change its permission.
Check this:
Rooting samsung Nexus S,
Okay I have done rooting of my device and push files into it.
To root your Android Nexus S device check How to get root and recovery for Nexus S on Windoes 7.
After do this:
$adb shell
#mount -o remount, rw -t yaffs2 /dev/block/mtdblock3 /system
#cat (file which you want) > (destination path)
Thats All !
I list out files in '/' by:
File directory = new File("/");
fill_listview(directory.listFiles());
And I get those in list:
sqlite_stmt_journals
config
cache
sdcard
d
etc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
I have two questions:
1.Why cann't I access '/data' folder just like Eclipse DDMS file explorer?
2.Why it is different from the DDMS which show only:
data
sdcard
system
Thanks!
On rooted device you can do this to access the /data folder:
Open cmd
Type 'adb shell'
su
Press 'Allow' on device
chmod 777 /data /data/data /data/data/com.application.pacakage
Go to the DDMS view in Eclipse
After this you should be able to browse the files on the device.
It is mostly because of security issues. If /data folder is visible to everyone, then some malicious app can read/temper/delete the data of some other app which can get really worse if some app is storing some sensitive data like password/credit card number etc. So the whole filesystem is only visible via debug console (or ddms).You can not access data of any app on the device unless it is rooted because by doing so, integrity of system might be compromised and it may lead of weird behavior. Which means you can not access cached data/databases of app.
I did this on a non-rooted device and it worked
run-as com.your.package ls -l /data/data/com.your.package
run-as com.your.package rm /data/data/com.your.package/databases/mydatabase.db
Reference: http://denniskubes.com/2012/09/25/read-android-data-folder-without-rooting/