# Android Studio Integration

**URL:** <https://discuss.zetetic.net/t/android-studio-integration/65>\
**Category:** SQLCipher FAQ\
**Created:** [August 20, 2014, 3:04pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65 "2014-08-20T15:04:23Z")\
**Posts on this page:** 13\
**Page:** 1

<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:** [August 20, 2014, 3:04pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/1 "2014-08-20T15:04:23Z")

</div>

Android Studio uses the Gradle-based build system, so project integration is slightly different than our standard integration [guide](http://sqlcipher.net/sqlcipher-for-android/) within an Android project. In this case, the location of the native libraries and the assets directory differ.

Once you have created your application project structure within Android Studio and have downloaded the SQLCipher for Android binaries, open the application folder structure. Navigate to the `app\src\main` directory and create two child folders, `jniLibs` and `assets`. Within the `jniLibs` directory, copy over the platform specific folders that contain the native .so files, these are found in the `libs` folder of SQLCipher for Android binary distribution. Next, copy over `icudt46l.zip` file from the `assets` directory into your applications `assets` directory. Finally, copy over `sqlcipher.jar`, `guava-r09.jar`, and `commons-codec.jar` to the `app\libs` directory. Once completed, your folder structure should look similar to this below:

 ![](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/1X/1606df0181c6678031cdce70ee24fd2a2887233e.png)  
Next, open your application within Android Studio and navigate to File → Project Structure…, select `app` from the Modules section on the left pane, then click on the Dependencies tab. Press the + sign at the bottom of the dependencies pane and add `sqlcipher.jar`, `guava-r09.jar`, and `commons-codec.jar` as file dependencies. It should look similar to this:

![](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/1X/51c1a291f15d77f253259190a947f236400c7ace.png)

You should now be able to use SQLCipher for Android within Android Studio:

```auto
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my);
      
        SQLiteDatabase.loadLibs(this);
        SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(":memory:", "Password1!", null);
        Cursor cursor = database.rawQuery("PRAGMA cipher_version;", null);
        cursor.moveToFirst();
        String version = cursor.getString(0);
        Log.i(TAG, String.format("SQLCipher version:%s", version));
        cursor.close();
        database.close();
    }

```

---

<div class="post-metadata">

**Author:** ![farhanK501](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@farhanK501](https://discuss.zetetic.net/u/farhanK501)\
**Post date:** [March 25, 2015, 3:10pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/2 "2015-03-25T15:10:07Z")

</div>

Should I follow the above steps? as Android Studio and SQLCipher Library are updated. This seems to be out dated.  
Thank You.

---

<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:** [March 25, 2015, 4:01pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/3 "2015-03-25T16:01:06Z")

</div>

Hello @farhanK501

Yes, these are still the correct steps to follow for SQLCipher for Android integration within an Android Studio project.

---

<div class="post-metadata">

**Author:** ![farhanK501](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@farhanK501](https://discuss.zetetic.net/u/farhanK501)\
**Post date:** [March 25, 2015, 4:11pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/4 "2015-03-25T16:11:11Z")

</div>

Thank you for the reply.  
I just copied down the sqlcipher.jar, sqlcipher-javadoc.jar into root of my already created '“libs” folder, and copied other \*.so files into proper architecture. But when I call `SQLiteDatabase.loadLibs( this );` into my mainActivity’s on `onCreate()` method…  
I get this…

```
03-25 12:59:57.500 1826-1826/com.myactivity.mainActivity E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.myactivity.mainActivity, PID: 1826
    java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myactivity.mainActivity1.apk"],nativeLibraryDirectories=[/data/app-lib/com.myactivity.mainActivity-1, /system/lib]]]: findLibrary returned null
            at java.lang.Runtime.loadLibrary(Runtime.java:358)
```

---

<div class="post-metadata">

**Author:** ![farhanK501](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@farhanK501](https://discuss.zetetic.net/u/farhanK501)\
**Post date:** [March 25, 2015, 4:17pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/5 "2015-03-25T16:17:32Z")

</div>

Further more there is no libraries in data/data/myactivity/lib…  
As I see online there should be those libraries added?  
Sorry for noobish question but I got my all day on this and can’t figure out what is going on…  
I am new to android…  
any help will be great full.  
ThankYou.  
I am on Mac.  
Using AndroidStudio latest.

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

---

<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:** [March 25, 2015, 4:37pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/6 "2015-03-25T16:37:23Z")

</div>

Hello @farhanK501

It is difficult to say what the issue might be, though my initial thought is it may be project configuration related. Did you also copy over the `icudt46l.zip` file into your `assets` folder? SQLCipher for Android no longer depends on `commons-codec.jar`, nor `guava-r09.jar`, otherwise your folder structure should match what is displayed above.

---

<div class="post-metadata">

**Author:** ![ShelterJames](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@ShelterJames](https://discuss.zetetic.net/u/ShelterJames)\
**Post date:** [November 16, 2015, 12:22pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/8 "2015-11-16T12:22:03Z")

</div>

Can I ask @developernotes which binary download file did you download? I downloaded from [https://github.com/sqlcipher/android-database-sqlcipher/releases/tag/v3.3.1-2](https://github.com/sqlcipher/android-database-sqlcipher/releases/tag/v3.3.1-2) and I can’t seem to match up the files in that to your instructions.  
Thanks,  
James

---

<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 16, 2015, 3:12pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/9 "2015-11-16T15:12:49Z")

</div>

Hello @ShelterJames

The instructions above are for integrating the zip binary distribution of SQLCipher for Android. If you are using the community edition of SQLCipher for Android, we only distribute SQLCipher for Android as a AAR package now which streamlines library installation with Gradle. The AAR packaging name can be found [here](https://discuss.zetetic.net/t/sqlcipher-for-android-3-3-1-2-release/829?u=developernotes).

---

<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:** [January 13, 2016, 9:11pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/10 "2016-01-13T21:11:31Z")

</div>

A post was split to a new topic: [Missing libstlport\_shared.so](https://discuss.zetetic.net/t/missing-libstlport-shared-so/1059)

---

<div class="post-metadata">

**Author:** ![mohan](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mohan](https://discuss.zetetic.net/u/mohan)\
**Post date:** [July 28, 2016, 1:10pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/11 "2016-07-28T13:10:57Z")

</div>

Hi Nick parker,

I have integrated the sqlcipher in my project using Android studio. i have followed the steps,

```
 1. Added the armeabi, armeabi-v7a,x86 folder to jniLibs.
 2. Added the icudt461.zip to assets folder.
 3. Added the sqlcipher.jar, guava-r09.jar,commons-codec.jar to libs folder.

```

Finally, I have run the project , i got the exception as

**" java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.myapp.myapp-2/base.apk”],nativeLibraryDirectories=[/data/app/com.myapp.myapp-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn’t find “libstlport\_shared.so” "**

I have created the new folder as “arm64”,“arm64-v8a” and paste the “libstlport\_shared.so” from armeabi. again run the project, that issue is not fixed.

i’m searching to fix the issue through tje internet , i couldn’t fix the issue,

please give the suggestion

---

<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 28, 2016, 1:31pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/12 "2016-07-28T13:31:12Z")

</div>

Hi @mohan

Are you using the community edition of SQLCipher for Android? If so, the easiest way to integrate the library is following [these](https://www.zetetic.net/sqlcipher/sqlcipher-for-android/) steps. You can not include 64-bit libraries with SQLCipher for Android at this time, more information can be found [here](https://discuss.zetetic.net/t/sqlcipher-for-android-native-library-support/1440).

---

<div class="post-metadata">

**Author:** ![mohan](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mohan](https://discuss.zetetic.net/u/mohan)\
**Post date:** [July 28, 2016, 2:03pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/13 "2016-07-28T14:03:27Z")

</div>

HI Nick ,  
Thanks for reply. Now the problem is fixed. The problem is “Native Library Support”.

---

<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:** [May 24, 2018, 1:24pm UTC](https://discuss.zetetic.net/t/android-studio-integration/65/14 "2018-05-24T13:24:41Z")

</div>

A post was merged into an existing topic: [How to use SQLCipher](https://discuss.zetetic.net/t/how-to-use-sqlcipher/2871/2)
