On a non-rooted android device, I can navigate to the data folder containing the database using the run-as
command with my package name. Most files types I am content with just viewing, but with the database I would like to pull if from the android device.
Is there a download
copy
or move
command from this part of adb shell? I would like to download the database file and view its content using a database browser.
One answer here involves turning entire application package into a compressed archive, but there is no further answer on how to extract that archive once this is done and moved to the machine, leaving me very sidetracked when there might be a more direct solution to begin with
By design
user
build of Android (that's what you have on your phone until you unlock the bootloader and flash the phone withuserdebug
oreng
software) restricts access to the Internal Storage - every app can only access its own files. Fortunately for software developers not willing to root their phones Google provides a way to access the Internal Storage of debuggable versions of their packages usingrun-as
command.To download the
/data/data/debuggable.app.package.name/databases/file
from an Android 5.1+ device run the following command:To download multiple files in a folder under the
/data/data/debuggable.app.package.name/
at once - usetar
:Much much simpler approach to download the file onto your local computer:
In your PC shell run:
If anyone looking for pulling database from debug application may use the procedure below:
I've published a simple shell script for dumping databases:
It performs two distinct methods described here:
\r
characters that some devices output to the shell.From here you can use a variety of CLI or GUI SQLite applications, such as
sqlite3
orsqlitebrowser
, to browse the contents of the database.