在Android開發(fā)中搬瑰,如果需要查看本地數(shù)據(jù)庫萌衬,可以在adb shell中查看(當(dāng)然前提條件是真機(jī)root或者使用模擬器)坟乾,輸入下面的命令可以查看:
Last login: Thu Jun 15 10:02:21 on ttys000
JackRodeMacBook-Pro:~ jack$ adb shell
generic_x86_64:/ $ cd /data/data/cn.jackro.databasedemo/databases/
/system/bin/sh: cd: /data/data/cn.jackro.databasedemo/databases: Permission denied
2|generic_x86_64:/ $
但是當(dāng)執(zhí)行cd命令切換到應(yīng)用的數(shù)據(jù)庫目錄時损拢,卻提示Permission denied(權(quán)限拒絕)呵萨,經(jīng)查,可以執(zhí)行su命令切換到超級用戶來提高權(quán)限伶丐,訪問該文件悼做。命令如下所示:
Last login: Thu Jun 15 10:09:58 on ttys000
JackRodeMacBook-Pro:~ jack$ adb shell
generic_x86_64:/ $ cd /data/data/cn.jackro.databasedemo/databases
/system/bin/sh: cd: /data/data/cn.jackro.databasedemo/databases: Permission denied
2|generic_x86_64:/ $ su
generic_x86_64:/ # cd /data/data/cn.jackro.databasedemo/databases
generic_x86_64:/data/data/cn.jackro.databasedemo/databases # ls
BookStore.db BookStore.db-journal
generic_x86_64:/data/data/cn.jackro.databasedemo/databases #