# android.database.sqlite.SQLiteException: file is not a database (code 26): , while compiling: SELECT COUNT(\*) FROM sqlite\_schema;

**URL:** <https://discuss.zetetic.net/t/android-database-sqlite-sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6537>\
**Category:** Issues\
**Created:** [July 16, 2024, 1:22am UTC](https://discuss.zetetic.net/t/android-database-sqlite-sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6537 "2024-07-16T01:22:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali\_Imran](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/ali_imran/32/2267_2.png) [@Ali\_Imran](https://discuss.zetetic.net/u/Ali_Imran)\
**Post date:** [July 16, 2024, 1:22am UTC](https://discuss.zetetic.net/t/android-database-sqlite-sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6537/1 "2024-07-16T01:22:59Z")

</div>

Hay Team,

i am using :

```
**implementation ("net.zetetic:sqlcipher-android:4.6.0@aar")**

```

\*\* implementation (“androidx.sqlite:sqlite:2.2.0”)\*\*

if i running my app in my device samsung S10, my app crash and this error android.database.sqlite.SQLiteException: file is not a database (code 26): , while compiling: SELECT COUNT(\*) FROM sqlite\_schema; , but if i running in other divice or emulator, my app no crash and normal i useed, pliss help i stak because this bug, thanks

this my code :

```auto
abstract class QuranDatabase : RoomDatabase() {

    abstract fun quranDataDao(): QuranDataDao

    companion object {
        @Volatile
        private var INSTANCE: QuranDatabase? = null
        private val base64EncodeDbKey: String = BuildConfig.BASE64_KEY_DB

        fun getDatabase(context: Context): QuranDatabase {
            return INSTANCE ?: synchronized(this) {
                val passphrase = base64EncodeDbKey.toByteArray(Charsets.UTF_8)
                val factory = SupportOpenHelperFactory(passphrase)
                val instance = Room.databaseBuilder(
                    context.applicationContext,
                    QuranDatabase::class.java,
                    "quran_database"
                )
                    .openHelperFactory(factory)
                    .createFromAsset("databases/iqra.db")
                    .build()
                INSTANCE = instance
                instance
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [July 16, 2024, 2:30pm UTC](https://discuss.zetetic.net/t/android-database-sqlite-sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6537/2 "2024-07-16T14:30:15Z")

</div>

Hi @Ali_Imran,

- Does this database file already exist?
- If it exists, is it a SQLCipher-encrypted database, or SQLite plaintext database?
- If it is a SQLCipher-encrypted database, which version of SQLCipher was used to encrypt it?
- Are you able to open the database file using an external tool such as DB Browser for SQLite?

---

<div class="post-metadata">

**Author:** ![Ali\_Imran](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/ali_imran/32/2267_2.png) [@Ali\_Imran](https://discuss.zetetic.net/u/Ali_Imran)\
**Post date:** [July 16, 2024, 3:24pm UTC](https://discuss.zetetic.net/t/android-database-sqlite-sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6537/3 "2024-07-16T15:24:12Z")

</div>

yes sir my database already exists, yes I can open it with DB Browser for sql lite, I use SQLCipher 4

this picture setting sqlShiper in my db browser :

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/2X/0/08aebcb10730b1726318a88caf21be91b4e9aaa5.jpeg)

but this error occurs only on my Samsung S10 devices, if I run it on the emulator and the Android version is the same, it doesn’t crash

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [July 16, 2024, 8:38pm UTC](https://discuss.zetetic.net/t/android-database-sqlite-sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6537/4 "2024-07-16T20:38:42Z")

</div>

Hi @Ali_Imran,

Can you reproduce this behavior in a small standalone demo application with a sample database which you can share publicly? We would be happy to review that.
