简体   繁体   中英

Android: SQLite database location

I created a SQLite database but I can not find it using Android Device Monitor: the Data folder has a + sign, but when I click nothing appears. I am using Android Studio Emulator with API 24. Is there any way I can find the database using Android Device Monitor?

如果要查看数据库数据或方案,可以尝试使用Stetho工具。

There's a known bug on the Android Device Monitor when used against emulators shipped with API level 24+ . You can recreate your emulator with API level 23 or below. If you still get the same issue, you can use the terminal like:

Run adb root to give you the root permissions.

To see devices connected:

adb devices
List of devices attached
emulator-5554  device

Run adb -s emulator-5554 shell to link this emulator. On successful connection to the shell change directory to the databases path:

cd /data/data/<your app package name>/databases/

List the contents of that directory and confirm if your database is there:

$ ls
mydb.sqlite3
main.db

From there you can then pull your database with the following command:

adb pull /data/data/com.packagename.app/databases/mydb.sqlite3 /local/path

You can use this library by mindorks to view your sqlite database.

https://github.com/amitshekhariitbhu/Android-Debug-Database

I hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM