While there are tons of posts about ADB, I think we can all agree it is an elusive beast. Therefore asking if anyone can shed some light on the following:
The objective is to backup data from an app on device #1, change some database data in the app's database file stored in root/data/data/com.AppName.../apps/db
, repackage the changes into an .ab and restore it to device #2 which will have the same App installed.
I have managed to create a .ab via adb backup (without .apk), have manipulated the db data after unpacking it from the .ab and have packed everything back into a .ab ready for restore to a new target device.
However, the restore does not yield any change on the new target device where the app has been pre-installed. This post seems to suggest that the app has to be installed via adb in order to get the data loaded.... but I'm not sure I'm understanding that.
I do have a copy of the .apk for the app which I could point to the mentioned restore script, but just not sure if that's the thing to do.
One more note is that I am working with unrooted devices. While I can see how adb backup could easily have read permission to app data, I never understood whether adb restore has permission by default to write app data to its destination under /root/data/data.
Sorry for the long post but just trying to be clear.
Thanks for any thoughts!
adb restore
I would copy the .ab file to the phone and use the commandbu
insideadb shell
.adb backup
is just a wrapper for this bu binary, but executing it directly on the phone has the advantage that you see all potential error and warning messages. In parallel I recommend to have anadb logcat
running to see if there are error message in logcat why the restore does not work.