Encrypting existing database

I’m a beginner. I read this topic(Encrypting database with Room createFromAsset() method - #2 by commonsguy) and tried to imitate it, but it doesn’t work.
The log says database is encrypted. But when I look at the contents of the database by Database Inspecter,it’s empty.Thank in advance for any help.

String str = "pass";
char[] pass = str.toCharArray();

Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "dictionary_word16")

SQLCipherUtils.State state = SQLCipherUtils.getDatabaseState(getApplicationContext(), "dictionary_word16");
Log.d("TAG", String.valueOf(state));
if (state == SQLCipherUtils.State.UNENCRYPTED) {
    try {
        SQLCipherUtils.encrypt(getApplicationContext(), "dictionary_word16", pass);
        Log.d("TAG", "Successfully encrypted database!");
    } catch (IOException e) {
        Log.e("TAG", "Failed to encrypt previously unencrypted database!");

final byte[] passphrase = SQLiteDatabase.getBytes(pass);
final SupportFactory factory = new SupportFactory(passphrase);

AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "dictionary_word16")

A few notes:

  1. I don’t know that the database actually exists after your initial build(). I think that it might be lazy-created on first use.

  2. You should close() the initial database before trying to encrypt it.

  3. While I have not tried Database Inspector with SQLCipher for Android, I would be surprised if it is supported. Did it prompt you for a passphrase?