开发者

Access sqlite database on android device [duplicate]

开发者 https://www.devze.com 2023-02-07 23:28 出处:网络
This question already has answers here: where is my app? /data appears empty (3 answers) Closed 8 years ago.
This question already has answers here: where is my app? /data appears empty (3 answers) Closed 8 years ago.

I'm trying to access the sqlite database file on the device. I mean, I've launched the app on the device via adb. And now I wanto to downl开发者_如何学JAVAoad this file as I did before on emulator via DDMS. But when I select the device on DDMS and open the folder data, it is empty.

Is it the right way to do? Or there is another way to download this db file.

Thanks.


You can access to the data folder without root, provided the application is debuggable

<application
 ...
        android:debuggable="true"
 ...

To list the base directory :

adb shell "run-as com.your.package ls -l"

To copy a file :

adb shell "run-as com.your.package cat relative/path > /sdcard/some_name"
adb pull /sdcard/some_name

Unfortunately pre-ICS run-as is quite buggy. The usual symptom is a

run-as: Package 'com.your.package' is unknown

message.


Have you tried adb directly?

adb pull /data/data/the.package.of.the.app/databases/the_name_of_the_database.db
0

精彩评论

暂无评论...
验证码 换一张
取 消