Not able to access the database file through adb s

2019-06-14 02:27发布

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条回答
看我几分像从前
2楼-- · 2019-06-14 03:03

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>
查看更多
登录 后发表回答