tags:

views:

84

answers:

2

I am having trouble accessing the database while I am developing on the phone. Whenever I execute

cd /data/data/com.mycompck/databases

then if I try to run ls I get opendir failed, Permission denied

Or whenever I type in: sqlite3 I get sqlite3: permission denied

What I am doing wrong?

Are there some applications that can help me getting a human view of content resolvers values and/or SQLite databases?

A: 

To answer the first part of your question, check out this answer. Basically, your phone needs to have root access, and you need to run adb in root mode (using "adb root").

As for the second part, I use SQLite Database Browser to view my SQLite dbs (though that's only when the db is on my computer; don't know of any on-device browsers). I don't know of any way to get a human view of content resolvers.

Daniel Lew
Why do I need root access, I want to access my applications data, as I am the developer I would love to get access to it.
Pentium10
adbd cannot run as root in production builds
Pentium10
Add an export or backup function to your app that copies the database to the SD card.
CommonsWare
@Pentium10: Because that's the way it works, access to the data directory is locked for non-root access. I don't make the rules. :P CommonsWare is correct though, that's a decent workaround.
Daniel Lew
A: 

You have to be root to access any database file. So, you can either get root on your phone (look for information on Google) or debugging the database just from the emulator (wich gives you root access always).

Bye!

Cristian
Unfortunately I can't debug from Emulator the database as the emulator doesn't have the apps I am using (Agenda, Bluetooth, Wifi).
Pentium10
But you can install those apps to the emulator: adb install appname.apk Anyway, I highly recommend to root your phone :) http://www.google.com.co/search?q=root+android
Cristian