# Implement SQLcipher in to a app with few modules

**URL:** <https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887>\
**Category:** SQLCipher\
**Created:** [November 19, 2015, 11:28am UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887 "2015-11-19T11:28:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sachithmsw](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@sachithmsw](https://discuss.zetetic.net/u/sachithmsw)\
**Post date:** [November 19, 2015, 11:28am UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887/1 "2015-11-19T11:28:42Z")

</div>

I am trying to encrypt my database using SQLcipher. In my app there are three separate modules(Main app has dependencies to these modules). Database part is done in a separate module(Not in the app module). I have followed the instructions and my code build successfully.  
But my app crashes when I try to call “SQLiteDatabase.loadLibs(context)”.  
Error massage is “java.lang.UnsatisfiedLinkError: Couldn’t load stlport\_shared from loader dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.stl.blelogger-1.apk”],nativeLibraryDirectories=[/data/app-lib/com.stl.blelogger-1, /vendor/lib, /system/lib]]]: findLibrary returned null” .

I have added all the libraries in to the module where I develop the database(Not to the main app module).

Can any one help me to fix this…

Thanks.

---

<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:** [November 19, 2015, 1:54pm UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887/2 "2015-11-19T13:54:47Z")

</div>

Hello @sachithmsw

It appears that the native libraries (i.e., .so files) are not being bundled within your application during compilation. Can you review your project configuration and see if you can make the appropriate adjustments?

---

<div class="post-metadata">

**Author:** ![commonsguy](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/commonsguy/32/75_2.png) [@commonsguy](https://discuss.zetetic.net/u/commonsguy)\
**Post date:** [November 19, 2015, 2:20pm UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887/3 "2015-11-19T14:20:02Z")

</div>

In particular:

- Use the AAR if you are building with Android Studio
- Do not use the `1.5.0-beta2` edition of the Play Services Gradle plugin, as it screws up native binaries coming from AARs (`1.5.0` is out, apparently, and does not have this bug)

---

<div class="post-metadata">

**Author:** ![sachithmsw](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@sachithmsw](https://discuss.zetetic.net/u/sachithmsw)\
**Post date:** [November 19, 2015, 2:45pm UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887/4 "2015-11-19T14:45:08Z")

</div>

Hi, Thanks for the reply. Please see this image. I have added .so files to my project.

 ![](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/1X/0b3e2ec79c9f93dd635a1c0236883f2e32056bd7.JPG)

Main activity is in app module. Database is handled in datastore module.

---

<div class="post-metadata">

**Author:** ![commonsguy](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/commonsguy/32/75_2.png) [@commonsguy](https://discuss.zetetic.net/u/commonsguy)\
**Post date:** [November 19, 2015, 3:18pm UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887/5 "2015-11-19T15:18:50Z")

</div>

Since you are using Android Studio, words cannot express how strongly I recommend that you switch to using the AAR, rather than trying to manually integrate the various files:

`compile 'net.zetetic:android-database-sqlcipher:3.3.1-2@aar'`

---

<div class="post-metadata">

**Author:** ![sachithmsw](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@sachithmsw](https://discuss.zetetic.net/u/sachithmsw)\
**Post date:** [November 20, 2015, 5:31am UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887/6 "2015-11-20T05:31:29Z")

</div>

Hi, Thank you for your comment.  
Could you please tell me how to use AAR or derect me to a good tutorial.

Thanks.

---

<div class="post-metadata">

**Author:** ![commonsguy](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/commonsguy/32/75_2.png) [@commonsguy](https://discuss.zetetic.net/u/commonsguy)\
**Post date:** [November 20, 2015, 1:24pm UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887/7 "2015-11-20T13:24:47Z")

</div>

You use it the same way that you use `appcompat-v7`, `support-v4`, or lots of other dependencies with Android Studio. In your module’s `build.gradle` file, list SQLCipher for Android as a dependency.

For example, [this sample app](https://github.com/commonsguy/cw-omnibus/tree/master/Database/ConstantsSecure-AndroidStudio) has:

```auto
dependencies {
  compile 'net.zetetic:android-database-sqlcipher:3.3.1-2@aar'
}

```

---

<div class="post-metadata">

**Author:** ![sachithmsw](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@sachithmsw](https://discuss.zetetic.net/u/sachithmsw)\
**Post date:** [November 23, 2015, 3:52am UTC](https://discuss.zetetic.net/t/implement-sqlcipher-in-to-a-app-with-few-modules/887/8 "2015-11-23T03:52:43Z")

</div>

Thank you very much…
