如何在Android设备上查看SQLite数据库? [英] How do I view the SQLite database on an Android device?

查看:325
本文介绍了如何在Android设备上查看SQLite数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQLite数据库中有一组数据。我需要在设备上查看数据库。我该如何做?

I have a set of data in an SQLite database. I need to view the database on a device. How do I do that?

我已签入ddms模式。文件资源管理器中的数据为空。

I have checked in ddms mode. The data in file explorer is empty.

推荐答案

这里是一步一步的说明答案)。

Here are step-by-step instructions (mostly taken from a combination of the other answers). This works even on devices that are not rooted.


  1. 连接设备并在调试模式下启动应用程序。

  1. Connect your device and launch the application in debug mode.

您可能想使用 adb -d shellrun-as com.yourpackge.name ls /data/data/com.yourpackge.name/

You may want to use adb -d shell "run-as com.yourpackge.name ls /data/data/com.yourpackge.name/databases/" to see what the database filename is.

注意: com.yourpackge.name 是您的应用程序包名称。

Notice: com.yourpackge.name is your application package name. You can get it from the manifest file.


  1. 将数据库文件从应用程序文件夹复制到SD

  1. Copy the database file from your application folder to your SD card.

adb -d shellrun-as com.yourpackge.name cat /data/data/com.yourpackge.name/databases/ filename.sqlite> /sdcard/filename.sqlite

filename.sqlite是您在创建数据库时使用的数据库名称

Notice: filename.sqlite is your database name you used when you created the database


  1. 数据库文件到您的计算机:

  1. Pull the database files to your machine:

adb pull /sdcard/filename.sqlite

这会将数据库从SD卡复制到您的ADB所在的位置。

This will copy the database from the SD card to the place where your ADB exist.

安装Firefox SQLite Manager: https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/

  1. Install Firefox SQLite Manager: https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/

欢迎使用!

这篇关于如何在Android设备上查看SQLite数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆