Replace SQLite Application Database with ADB

I am trying to replace my application database with ADB on the root device.

I do the following:

  • $adb shell
  • run-as my.app.package
  • cd databases
  • rm my_database.db
  • chmod 777 .
  • exit
  • exit
  • $adb push my_database.db /data/data/my.app.package/databases/my_database.db

The new database has been copied successfully.

But when I start my application again, it seems that the new database is being deleted and created again. Why?

Thanks.

+5
source share
1 answer

I do not know exactly why, but now it works. I have completed the following steps:

  • Open the application (in my application the database is created in the main mode)
  • Follow the instructions in the question using the open application
  • Close the application and delete it from memory.
  • Open app

Both versions of the databases are the same and I have no code in the onUpgrade method.

+1
source

All Articles