Android Eclipse DDMS - How to delete directory on device? - android

Using the DDMS Perspective in Eclipse, can you delete directories on the phone? You can definitely select and delete files, but I can't seem to delete any directories. The only way I have figured out how to is at the command prompt:
C:\>adb shell
$ rmdir /mnt/sdcard/Android/data/mydirectory/

I do not know if the android plugin supports the option you are looking for. But I can tell you that it depends on the device also. For example on rooted phones you can use HierarchyViewer and also on the emulator , but this tool will not work with none rooted devices.
You should consider that maybe you are not able to delete because your phone is not rooted. This is for the internal storage, and for external you should consider if your phone is connected with your pc with charge only mode or with disc storage mode. If you connect with charge only mode maybe there will be no-option for deleting files...
Again I do not have you the right answer but I gave you some tips you should definitely consider.

Use "adb shell %your device%" go to the folder you want to delete and
use 'rmdir %folder name%' ( make sure the folder is empty )

Related

Android - Can I edit a file in \Android\data\com.zzzzzz.zzz?

I have a Xiaomi device, not rooted.
I have an app and I want to try to see where it saves its data, I think it's in \Android\data\com.zzzzz.zzz (app name).
When I go that folder from my Windows PC I can see there are 2 subfolders but each of them appears to be empty.
Is it possible that the the subfolders are not empty and that I see them empty because the phone is not rooted?
If I connect to the phone with adb shell, is there a way to see if the subfolders are actually empty?
Thank you very much.
This is the command to get files from device adb pull Android\data\data\com.zzzzz.zzz.
You can list all files in the folder by $ adb exec-out run-as com.yourcompany.app ls -R /data/data/com.yourcompany.app/
Or you can use android studio device file explorer from sidebar to see your files.
You can't see the files if the app is not debuggable

Root Android phone

I have created a database for my app and I want to check .db folders to check the data inserted while developing. But my Android mobile will not allow to access data folder. To achieve this I have rooted my mobile with GingerBreak.apk. Device rebooted but nothing happened. How can I check my data base from my phone.
Note: I can't check the data using emulator, because app cant run on emulator, it uses, Bluetooth, WiFi,etc.
Regards,
Krishna
You need to install some file broswer(such as R.E file manager) to access to these .db files. They are located in /data/data/{package name} dir.
Meanwhile, you can access these file via command line.
For emulator:
Type adb shell in the command line, and you can see a "#" prompt.
Type 'cd /data/data/{package name}` to go to the very dir where the
.db file is located.
Now type sqlite3 <db file name, no extension> so that you can execute SQL command to read and control the .db file. Now you can see a "sqlite>" prompt.
For real device(phone must be rooted):
Step 2 and 3 are the same. In Step 1, you have to type "adb shell", and then "su" to see the "#" prompt.
Hope it helps.
To root your phone. You can use lucky patcher app.Although there are plenty of apps available around internet but i found it worth using
By using this app you can not only root your device as well as remove annoying ads and much more.

How to browse android emulator SD on Windows without Eclipse?

Can't understand how to browse android emulator sd card. I am using IDEA, not Eclipse and can't use Eclipse tool for this purpose.
Use DDMS. It is available as a standalone tool, in addition to the Eclipse perspective.
Or you can also use adb located in android-sdk-directory/tools.
To do this open up a command line and type adb shell when developing on Linux or adb.exe shell when developing on Windows then you will be logged in into your Android emulator where you can simply use basic UNIX commands to navigate to the SDcard. You'd do that like this cd /sdcard and to list whats in there you us ls.
Hope it helped.
I'm using ImDisk. Very easy to mount the iso file, just right click on it and choose mount from the menu. Add/Remove files as there will appear a new mounted unit and once done, right click and unmount. I also assumed you are running windows, as a nix user wouldn't ask such question :)

Can't access data folder in the File Explorer of DDMS using a Nexus One!

I have my Nexus One connected with the USB.
When I visit the File Explorer of the DDMS, if I click on the "data" folder the little plus near the name "data" disappear for 2-6 seconds and then reappear but the contenct of the folder "data" is not showed!
Here some other information:
the folder data has permissions drwxrwx--x
the OS of my PC is Windows XP
Eclipse v. 3.5.2
Android SDK 1.6
If the adbd daemon is running as root, you can browse /data using adb-based tools such as the DDMS file explorer or the adb shell.
If it's not, you can access a few files under /data and its children directly by their full path names, but you cannot browse (or 'cd' to) most of the folders, including /data itself.
"rooting" as an unofficial process means varying things and produces varying results - ie, adbd may or may not run as root.
If ro.secure is set to 0 in the startup scripts such as /init.rc, adbd will run as root, but that may not be a good idea on a user device. It is set to 0 on the emulator, and that's why you can browse /data there.
Finally, note that /init.rc is usually contained in a ramdisk image packed onto the kernel - you can't really edit it on the phone but would have to modify the image offline, re-attach it to the kernel, and re-flash them. Though if you have some sort of working 'su' hack you may be able to change the property temporarily and restart adbd.
In this link (http://denniskubes.com/2012/09/25/read-android-data-folder-without-rooting/) Dennis Kubes shows a method for accessing your application's data folder without root access.
Turns out there is a simple solution, the run-as command.
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
That will allow you to run commands as your app. You can also use run-as in interactive mode.
run-as com.your.package
shell#android:/data/data/com.your.package $ ls
cache
databases
lib
shared_prefs
rm databases/mydatabase.db
Interactive mode will drop you into the data folder for your app. You can navigate from there.
I don't think anyone really understands this question. Giorgio can use the DDMS File Explorer to browse the ./data folder on his phone. Pentium10 talks about needing root access on the phone.
Well I a retail Nexus One and a developer Nexus. I have always been able to use DDMS File Explorer to browse the ./data folder on my developer phone but not my retail phone. So I rooting my retail phone would help. I didn't.
So the bottom line is there is something different about the retail and developer phones. Until more research is done you won't be able to browse the data folder on your phone.
Hope this helps.

how mount userdata.img or userdata-qemu.img in osx

Disk Utility in OSX easily mounts an SD Card image as a device, but not so the other img files.
I want to get the database I just created in the Android Emulator off the drive and into my osx file system.
I updated my system with qemu using macports but no combination I try succeeds. Anyone figured out how to do this?
Obviously one way I can do this is run the app on my phone than mount the phone as a USB drive. But I don't wanna. I wanna get it off the drive the emulator uses :-)
Thanks in advance, folks.
Michael
Can't you just use adb to pull the database off of the emulator? I actually just answered a similar question... here it was:
The database for a specific app lives in /data/data/[packagename]/databases
The packagename is the package you define in your manifest, for instance /data/data/org.vimtips.supacount/databases/counts.db.
You can view it with adb shell and type sqlite3 /data/data/org.vimtips.supacount/databases/counts.db
Or you can pull it from the device to look at it with a third party utility, with a command like adb pull /data/data/org.vimtips.supacount/databases/counts.db ..
Use the File Explorer in DDMS (from Eclipse SDK), you can see the whole file system there and download/upload files to the desired place. That way you don't have to mount and deal with images, and no adb commands either

Categories

Resources