# How to fully integrate Sqlcipher in Android so that can decrypt encrypted sqlcipher database

**URL:** <https://discuss.zetetic.net/t/how-to-fully-integrate-sqlcipher-in-android-so-that-can-decrypt-encrypted-sqlcipher-database/5294>\
**Category:** SQLCipher\
**Created:** [February 9, 2022, 7:11pm UTC](https://discuss.zetetic.net/t/how-to-fully-integrate-sqlcipher-in-android-so-that-can-decrypt-encrypted-sqlcipher-database/5294 "2022-02-09T19:11:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doli](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/doli/32/1761_2.png) [@Doli](https://discuss.zetetic.net/u/Doli)\
**Post date:** [February 9, 2022, 7:11pm UTC](https://discuss.zetetic.net/t/how-to-fully-integrate-sqlcipher-in-android-so-that-can-decrypt-encrypted-sqlcipher-database/5294/1 "2022-02-09T19:11:03Z")

</div>

I have added following in `app/build.gradle` file:

implementation ‘net.zetetic:android-database-sqlcipher:4.5.0@aar’

I have done following as instructedon zetectic site " Next we will modify the source of the activity to properly initialize the native libraries for SQLCipher and then create our database file inserting a record. In particular, note the import of `net.sqlcipher.database.SQLiteDatabase` instead of `android.database.sqlite.SQLiteDatabase` as well as the call to `SQLiteDatabase.loadLibs(this)` . The call to `SQLiteDatabase.loadLibs(this)` must occur before any other database operation."

I am able to successfully encrypt the database and able to open it by provide the passphrase.

The problem that I am facing is when I am trying to ATTACH plaintext.db to export encrypted database to plaintext using adb. (Getting this ‘Error: file is encrypted or is not a database’)

Am I missing any libraries?

---

<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:** [February 11, 2022, 2:15pm UTC](https://discuss.zetetic.net/t/how-to-fully-integrate-sqlcipher-in-android-so-that-can-decrypt-encrypted-sqlcipher-database/5294/2 "2022-02-11T14:15:09Z")

</div>

Hi @Doli

We have an example within our SQLCipher for Android test suite which shows how to perform an export to plaintext. Would you take a look at this and compare it to your code for differences?

> <https://github.com/sqlcipher/sqlcipher-android-tests/blob/master/app/src/main/java/net/zetetic/tests/ExportToUnencryptedDatabase.java>

---

<div class="post-metadata">

**Author:** ![Doli](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/doli/32/1761_2.png) [@Doli](https://discuss.zetetic.net/u/Doli)\
**Post date:** [February 11, 2022, 8:07pm UTC](https://discuss.zetetic.net/t/how-to-fully-integrate-sqlcipher-in-android-so-that-can-decrypt-encrypted-sqlcipher-database/5294/3 "2022-02-11T20:07:11Z")

</div>

Thank you for your response.

Is there any way to do this through adb shell? If yes, what all changes needed to be done.
