I have recently struggled with getting data out of my own Android application that I have installed from Play Store and wanted to backup my data before deploying new development version. These so-called app specific data are protected so that other apps cannot see them and what’s more, it is not straightforward for users to see them, either.
I assume you have
adb installed and your Android device connected with
developer mode enabled on it. In following commands, replace
with your chosen application
To backup data, execute:
adb backup -f backup.ab -apk com.example.app
adb reports that this command is
deprecated, but you can ignore it:
Then, a prompt on your Android device will be shown:
Click “Backup My Data” to complete the backup.
backup.ab file is almost an archive but without header. You can
extract data from it using one-line
command (if you are on Windows, use your
( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar xfvz -
Data of your app will be extracted into folder
To restore the (possibly modified) data into a development version of my app, I use Android Studio’s Device File Explorer and its “Upload” option.
If you need to restore the created backup (you don’t even need to extract it in
the first place), you can simply use command inverse to
adb restore backup.ab
Let me know what you think and feel free to ask questions about this post in dedicated thread on Reddit.