lundi 5 octobre 2015

Override Android SQLite database in a release build

I am developing an Android App that uses SQLite and I have a device which is not rooted.

For testing purposes, I would like to be able to replace the DB file in my device with one from my PC.

The constraints to this problem are:

  1. The app installed on the device is from a release build
  2. I don't want to root the device
  3. I don't want to add specific code to my app to accomplish this override

Is this possible? How?

I tried the following:

  • Install a debug version
  • Use adb to push the DB to the device from the PC
  • Use adb backup command to backup the app data to the PC
  • Uninstall the debug build
  • Install the release build
  • Use adb restore command to restore the app data from the backup

This approach works if the re-installation is of debug build and doesn't work when the re-installation is of release build.

I am guessing there may be a way to tweak the backup file so that it will work, but perhaps there is a more straight forward approach that I am missing?

Aucun commentaire:

Enregistrer un commentaire