So I have an installed application on my Android phone and it stores some data in an password protected SQLite database in the /data/data//databases/ folder. I used adb shell to move the database to my PC and unlocked it, modified some data and then moved it back to it's original location. However, when I run the application it keeps crashing and throw SQLiteExceptions "Couldn't open database".

If I remove the modified database and restart the application everything works fine and a new, empty database is created, as expected. But if I move that database to another location and then move it back the application crashes and give the same exceptions again, even though the database isn't modified.

Why can't I move around the database without making the application unable to read it? I would really appreciate some help here!

  • 1
    Hi and welcome to RE.SE. There is a plethora of possible causes of why this doesn't work. One could be that the SQLite version on your PC is much more recent and it upgraded the file format. But you definitely don't give enough information for anyone to help you beyond wild guesses. Please edit your question to add information, such as the app affected and version numbers of the SQLite tools used on either end.
    – 0xC0000022L
    Jan 21, 2019 at 11:50
  • please add an answer instead of editing the question
    – Igor Skochinsky
    Jan 22, 2019 at 18:40

1 Answer 1


I managed to solve it and I will write it here so that it hopefully can help someone more facing the same issue. A more detailed description of the problem: On my rooted Galaxy S5 I had an application installed which had a encrypted SQLite database in the /data/data//database/ folder. If I moved the database outside of the /data/ and then pasted it back into it's original location the app would crash instantly on start up, and I still don't know why (I didn't change anything in the file itself and i restored the original file permissions and ownerships since they had automatically(?) been altered during the move) but the app would still crash.

The solution (and I don't really know why it works) would be to use the dd command to make a copy of the database, use adb to pull that copy to my PC, edit it with DB Browser for SQLite and then push that manipulated copy back into /data/data//database and lastly use dd to copy the content of the manipulated database into the original database.

Step by step:

dd if=database of=database_copy
adb pull /data/data/<package-name>/database/database_copy
[Edit and then save the database_copy]
adb push database_copy /data/data/<package-name>/database/
dd if=database_copy of=database

Thats it! The app starts fine this time and reads the database with my own values!

  • Can you try disabling SELinux by running setenforce 0 as root Feb 17, 2020 at 15:50

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .