Android 模拟器在哪里存储 SQLite 数据库? [英] Where does Android emulator store SQLite database?

查看:35
本文介绍了Android 模拟器在哪里存储 SQLite 数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个将数据存储在 SQLite 数据库中的 Android 应用程序.我的问题是,当您使用模拟器时,这个数据库文件存储在文件系统的哪个位置?

I'm working on an Android application that stores data in a SQLite database. My question is, where does this database file get stored on the filesystem when you're using an emulator?

我已经看到它存储在

/data/data/package_name/databases

但我需要知道本地机器硬盘上实际映射到的位置.数据库在模拟器的多次运行中仍然存在,即使在关闭机器之后也是如此,因此它不能只驻留在 RAM 中...

but I need to know where on my local machine's hard drive that actually maps to. The database persists on multiple runs of the emulator, even after having shut down the machine, so it can't just reside in RAM...

推荐答案

模拟器的文件系统未映射到硬盘驱动器上的目录.模拟器的磁盘映像存储为映像文件,您可以通过 Eclipse(在工具栏中查找 G1 外观的图标)或模拟器二进制文件本身(运行emulator -help"以获取选项说明)来管理该文件.

The filesystem of the emulator doesn't map to a directory on your hard drive. The emulator's disk image is stored as an image file, which you can manage through either Eclipse (look for the G1-looking icon in the toolbar), or through the emulator binary itself (run "emulator -help" for a description of options).

您最好从命令行使用 adb 进入正在运行的模拟器.如果您可以获得特定的目录和文件名,您可以执行adb pull"以将数据库文件从模拟器中取出并放到您的常规硬盘上.

You're best off using adb from the command line to jack into a running emulator. If you can get the specific directory and filename, you can do an "adb pull" to get the database file off of the emulator and onto your regular hard drive.

编辑:删除了这也适用于无根设备的建议 - 它仅适用于模拟器,以及您以 root 身份操作 adb 的设备.

Edit: Removed suggestion that this works for unrooted devices too - it only works for emulators, and devices where you are operating adb as root.

这篇关于Android 模拟器在哪里存储 SQLite 数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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