0
votes

I am trying to retrieve the database file from the phone. I am using the cmd and adb shell to do this. After access data/data when i do ls, it shows permission denied. I have phone my rooted. USB debugging is on. My CMD image is attached. Please guide where i am wrong. Thanks in advance

enter image description here

1
You just run su to get root access from the shell.OneCricketeer
Thanks you for you command. it works to access the files but now i cannot copy and paste the database file to my computer.Mudasir Sharif
You can't "send" files from within ADB, you have to pull themOneCricketeer
Yeahh I am doing the same.. like first I write cp databasename /sdcard/ and then pull databasename /sdcard/... I dont know if my commands are wrong but I am doing sam way..Mudasir Sharif
It is not really clear why you need to copy out the database. You can use a tool like Stetho to inspect itOneCricketeer

1 Answers

2
votes

To list all databases that you have:

adb shell run-as com.example.myapp ls /data/data/com.example.myapp/databases/

To download them, first, copy them to sdcard and then, pull it:

adb shell run-as com.example.myapp cp /data/data/com.example.myapp/databases/DATABASE_NAME /sdcard/

adb pull /sdcard/DATABASE_NAME

NOTE:

Remember to replace com.example.myapp by package name from your app.

Replace com.example.myapp by package marked in your AndroidManifest.xml

<manifest 
    package="com.example.myapp"/>
    ....
</manifest>