Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android - FileExplorer eclipse as root

I have a rooted Nexus One and when I issue the following commands on the terminal I'm able to view the database of the app I'm developing.

adb shell
su 
cd data/data/.../databases/
sqlite3 events.db

Now this works fine but I want to be able to pull the file and view it with a gui SQLITE application/browser (for example the Firefox plugin)

I used to be able to access the data folder from Eclipse using FileExplorer but it suddenly stopped working and I'm just wondering if there's a way to be able to do that again..

Thank you

like image 811
kkudi Avatar asked Jan 20 '23 07:01

kkudi


2 Answers

After much research through Google, I simplified accessing a SQLite database in Eclipse. I'll compile my research in an answer here for accessing a SQLite database on a connected or emulated Android phone for viewing within Eclipse.

To browse files from a specific app on your device, grant read and access privileges of each folder in the path to the app.

  1. Open cmd/terminal
  2. Type 'adb shell'
  3. su
  4. Press 'Allow' on device
  5. chmod 777 /data /data/data /data/data/com.application.package
  6. chmod -R 777 /data/data/com.application.package

After this you should be able to browse the files on the device.

A very useful Eclipse plugin for browsing a SQLite database on an Android phone from within Eclipse is the, seemingly no longer supported, Questoid browser plugin

  1. Currently, you can download plugin from Java2S here: http://www.java2s.com/Code/Jar/c/Downloadcomquestoidsqlitebrowser120jar.htm
  2. Place the plugin's com.questoid.sqlitebrowser_1.2.0.jar file in your Eclipse plugins folder (e.g. /path/to/eclipse/plugins)
  3. Restart Eclipse
  4. Switch to the DDMS Perspective in Eclipse
  5. Select appropriate device (in this case your phone, but alternatively your Android Emulator)
  6. Go to the 'File Explorer' tab to browse device's files
  7. Find and select the database under /data/data/com.application.package/databases/database_name
  8. In Eclipse, in the File Explorer, there is a blue 3-layer pancake-like cylinder icon in the upper-right corner of the File Explorer Window that you click.

    Click blue 3-layer pancake-like cylinder icon in the upper-right corner of the File Explorer Window http://www.tylerfrankenstein.com/sites/default/files/styles/large/public/questoid.png

    This opens the database file in a Questoid tab in the same window as LogCat.

  9. Click to the 'Questoid SQLite Browser' tab
  10. Click on to the 'Browse Data' sub tab
  11. Select your table from the drop down menu
  12. And...you have your data for viewing pleasure

Hope you guys find this post more specifically useful as a step-by-step for viewing your database.


References

  • StackOverflow Post on Accessing Appropriate Folder
  • Blog Post on Accessing Questoid Plugin
like image 168
garromark Avatar answered Jan 30 '23 04:01

garromark


Right now it appears that your device is set up so that the adb shell is not by default root, and you have to use su to get a root shell. The DDMS file explorer in eclipse would not do so, so it would only have root access if adbd is set to run as root and provide root access to clients by default.

You could check this out from an adb shell with

ps 

(and see if the 'ps' process is running as root or shell) or

getprop ro.secure

Using an su root shell, you could remount the root filesystem and change ro.secure to 0 in default.prop - amongst other things, this would result in adbd running as root and by default granting root shells. However, this has security implications and you may not want to leave it that way. You would need to do a web search for the exact shell remount command for your particular device (since the adb convenience one wouldn't work in the case where adbd was not yet root).

You could also see if the 'adb root' command would work to put the adbd into root mode.

It may be that your system is not 'rooted' in the sense of having any configuration changes made, but instead only in the sense that there's a custom su binary present which will allow unprivileged users who know about the possibility to get a root shell - the stock tools wouldn't know about that possibility and so would not be able.

like image 43
Chris Stratton Avatar answered Jan 30 '23 05:01

Chris Stratton