Is there a way to use adb uninstall on the apk, but make the data persist? I've lost the original key to my app, and now I would like to update it, but without losing the previous data. So I need to uninstall it first to add the new apk with the new key. Is this possible?
I forgot to mention I'm executing commands via a .bat file.
EDIT: Should have specified, the following will work only for Android 4.0 and above.
Just enable adb
access, and use this command:
adb backup -noapk -f /backup/myAppBackup.ab com.yourapp.packagename
You should then have a file stored in your root directory (on Windows, your C:\ or equivalent) in a folder called backup.
Once you have this file, assuming the package name stays the same, you should be able to simply use the command
adb restore /backup/myAppBackup.ab
to restore the data.
Now, I don't know for certain that this will work once you've changed the key, but I'm fairly certain it relies only on the package name, so the signature key shouldn't matter. More info here.
Batch-friendly version.
My-make-clean.bat:
adb pull /data/data/com.blah.bla/file1 file1
adb pull /data/data/com.blah.bla/file2 file2
adb pull /data/data/com.blah.bla/file3 file3
...
adb uninstall com.blah.bla
adb install YourApkFile.apk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With