Search code examples
javaandroiddatabasesqliteandroid-room

Android Room database file is invalid file format in DB browser


I am going to data/data/myPackage in emulator and download these three files about my apps database :

enter image description here

But when i import it to DB browser i faced with this error :

enter image description here

I think the problem is about permissions(-rw------) because when i import other database that has this (-rw-rw----),DB browser can open it.

Then how can i change permission or open my room database in DB browser?

This is my room config :

@Database(entities = {Authentication.class}, version = 1)
public abstract class InsensitiveDatabase extends RoomDatabase {

    private static InsensitiveDatabase INSTANCE;

    public abstract AuthenticationDao authenticationDao();

    public static InsensitiveDatabase getInsensitiveDatabase(Context context) {
        if (INSTANCE == null) {
            Editable editable = new SpannableStringBuilder("1234");
            SafeHelperFactory factory = SafeHelperFactory.fromUser(editable);
            INSTANCE = Room.databaseBuilder(context, InsensitiveDatabase.class, "insensitive.db")
                    .openHelperFactory(factory)
                    .build();
        }
        return INSTANCE;
    }
}

Solution

  • As i found The DB browser that developed in Linux cant open my encrypted room database because i open it in MAC OS.

    You can see more detail in this issue that i open it,i hope that this is useful for your problem.