I try to work with SQLite but I don't know what I'm doing wrong.

I've made an example to insert a records and it works but I can't see the database. I'm working with a real device.

I've found (in Internet) that the database should be in: /data/data/paquete.java.de.la.aplicacion/databases/database

But this folder seems empty. I've tried with oi File Manager application and File Explorer of Eclipse.

On the other hand, I'm sure that the records have been inserted because if I debug, I can see the them in Log Cat.

Any ideas?

Thanks in advance.

有帮助吗?

解决方案

As long as the application is built in debug mode there is no need to have the device rooted. Try

adb shell
run-as your.package.name
ls databases

其他提示

In order to see the database files on a phone or through eclipse, your device needs to be rooted. If you want to test your database to see what it looks like and if it's working otherwise, you can run your app on the emulator and see it just fine.

What is rooting..?!

You need to be rooted to be able to see the database.

With the emulator you have root access and you can use sqlite3 to open the database from within an emulator shell. Use .dump to dump all contents of the database.

So the commands you would have to do:

Open shell on emulator:

adb shell

Within shell:

cd /data/data/paquete.java.de.la.aplicacion/databases/databases

sqlite3 *yourdatabase.db*

Within sqlite3

.dump

Mit .exit geht's wieder raus aus sqlite3.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top