# SQLCipher and Google Pixel Android 7.1 (Nougat)

**URL:** <https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884>\
**Category:** SQLCipher\
**Created:** [December 21, 2016, 6:31pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884 "2016-12-21T18:31:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![earamsey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/earamsey/32/476_2.png) [@earamsey](https://discuss.zetetic.net/u/earamsey)\
**Post date:** [December 21, 2016, 6:31pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/1 "2016-12-21T18:31:20Z")

</div>

Hi,

I have android 7.1 nougat phone (Google Pixel). SQLCipher crashes when I call;

> @Override  
> _protected void onCreate(Bundle savedInstanceState) {_  
> \_ **SQLiteDatabase.loadLibs(this);**\_  
> _super.onCreate(savedInstanceState);_  
> _requestWindowFeature(Window.FEATURE\_NO\_TITLE);_

I configured my gradle app with;

> dependencies {  
> compile fileTree(dir: ‘libs’, include: [‘\*.jar’])  
> compile ‘net.zetetic:android-database-sqlcipher:3.5.4@aar’  
> compile group: ‘com.google.code.gson’, name: ‘gson’, version: ‘2.7’  
> compile project(path: ‘:nflibrary’)  
> compile ‘com.android.support:appcompat-v7:25.1.0’  
> compile ‘com.android.support:support-v4:25.1.0’  
> testCompile ‘junit:junit:4.12’  
> }

But I still get following in sql crash;

> E/AndroidRuntime: FATAL EXCEPTION: main  
> Process: com.zzzzzzzz.xxxxxxxx, PID: 3523  
> java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.zzzzzzzz.xxxxxxxx-2/base.apk”],nativeLibraryDirectories=[/data/app/com.zzzzzzzz.xxxxxxxx-2/lib/x86\_64, /data/app/com.zzzzzzzz.xxxxxxxx-2/base.apk!/lib/x86\_64, /system/lib64, /vendor/lib64]]] couldn’t find “libsqlcipher.so”  
> at java.lang.Runtime.loadLibrary0(Runtime.java:984)  
> at java.lang.System.loadLibrary(System.java:1530)  
> at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:196)  
> at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:189)  
> at com.zzzzzzzz.xxxxxxxx.HomeActivity.onCreate(HomeActivity.java:122)  
> at android.app.Activity.performCreate(Activity.java:6679)  
> at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)  
> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)  
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)  
> at android.app.ActivityThread.-wrap12(ActivityThread.java)  
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)  
> at android.os.Handler.dispatchMessage(Handler.java:102)  
> at android.os.Looper.loop(Looper.java:154)  
> at android.app.ActivityThread.main(ActivityThread.java:6119)  
> at java.lang.reflect.Method.invoke(Native Method)  
> at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)  
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)  
> Disconnected from the target VM, address: ‘localhost:8621’, transport: ‘socket’

how do I fix this problem?

---

<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:** [December 21, 2016, 7:00pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/2 "2016-12-21T19:00:23Z")

</div>

Are you sure that you have ARM libraries in your app? Your error message suggests that this APK only has x86 libraries.

---

<div class="post-metadata">

**Author:** ![earamsey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/earamsey/32/476_2.png) [@earamsey](https://discuss.zetetic.net/u/earamsey)\
**Post date:** [December 21, 2016, 7:01pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/3 "2016-12-21T19:01:19Z")

</div>

hmmm, I assumed I did, do I have to specify somewhere to have arm libraries too?

---

<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:** [December 21, 2016, 7:13pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/4 "2016-12-21T19:13:46Z")

</div>

It should be automatic. However, if you are using APK splits, or product flavors for specific binary targets, you would not be able to use the x86 APK on an ARM device like the Pixel. You might want to examine the APK itself (it’s just a ZIP archive) and see what `.so` files you have in there.

---

<div class="post-metadata">

**Author:** ![earamsey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/earamsey/32/476_2.png) [@earamsey](https://discuss.zetetic.net/u/earamsey)\
**Post date:** [December 21, 2016, 7:36pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/5 "2016-12-21T19:36:00Z")

</div>

> [@commonsguy](#):
>
> e

I have lib/x86;  
- libpl\_droidsonroids\_gif.so  
- librsjni.so  
- libRSSupport.so  
- libsqlcipher.so

---

<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:** [December 21, 2016, 7:54pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/6 "2016-12-21T19:54:40Z")

</div>

You should have `lib/x86/`, `lib/armeabi/`, `lib/armeabi-v7a/` directories. If you do not, there is an issue in your build process. I just tested one of my sample apps with v3.5.4 of the SQLCipher AAR, and I get all three of those directories in my APK.

---

<div class="post-metadata">

**Author:** ![earamsey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/earamsey/32/476_2.png) [@earamsey](https://discuss.zetetic.net/u/earamsey)\
**Post date:** [December 21, 2016, 7:59pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/7 "2016-12-21T19:59:19Z")

</div>

any idea how to fix?

---

<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:** [December 21, 2016, 8:18pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/8 "2016-12-21T20:18:09Z")

</div>

Since I have no idea how you are building your app, I cannot really answer that. [This sample app](https://github.com/commonsguy/cw-omnibus/tree/master/Database/ConstantsSecure-AndroidStudio) is what I tried and works, so you might compare your `app/build.gradle` file with mine. The GitHub repo uses SQLCipher v3.5.0, but I tried v3.5.4 here and both APKs had the ARM binaries as well as x86.

---

<div class="post-metadata">

**Author:** ![earamsey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/earamsey/32/476_2.png) [@earamsey](https://discuss.zetetic.net/u/earamsey)\
**Post date:** [December 21, 2016, 11:30pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/9 "2016-12-21T23:30:54Z")

</div>

Those libraries get built when I do a build api, but when I click on debug-run they don’t seem to get made and deployed to device. any ideas ? Do I have to tell it android-studio to deploy those libraries when debugging or something?

---

<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:** [December 21, 2016, 11:44pm UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/10 "2016-12-21T23:44:51Z")

</div>

No, that should be automatic. With Instant Run turned off, there is no difference between Android Studio telling Gradle to build the app and you telling Gradle to build the app from the command line.

Try a full uninstall and reinstall of the app. If that does not help, disable Instant Run, then do a full uninstall and reinstall of the app.

And if none of that helps, hopefully somebody else has some ideas, as I am about out of them…

---

<div class="post-metadata">

**Author:** ![earamsey](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/earamsey/32/476_2.png) [@earamsey](https://discuss.zetetic.net/u/earamsey)\
**Post date:** [December 22, 2016, 12:50am UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/11 "2016-12-22T00:50:21Z")

</div>

so even though I press the “Debug-‘app’” button I should still get everything I need built into apk deployed to phone? hmmmm. This is not happening and I just uninstall app from settings. Disabled instant run “Preferences-\>Instant Run” -\> check mark off. I still get same issue! should I also disable Jit or something?

---

<div class="post-metadata">

**Author:** ![ac987](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/ac987/32/502_2.png) [@ac987](https://discuss.zetetic.net/u/ac987)\
**Post date:** [January 6, 2017, 11:31am UTC](https://discuss.zetetic.net/t/sqlcipher-and-google-pixel-android-7-1-nougat/1884/12 "2017-01-06T11:31:39Z")

</div>

> [@earamsey](#):
>
> java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.zzzzzzzz.xxxxxxxx-2/base.apk”],nativeLibraryDirectories=[/data/app/com.zzzzzzzz.xxxxxxxx-2/lib/x86\_64, /data/app/com.zzzzzzzz.xxxxxxxx-2/base.apk!/lib/x86\_64, /system/lib64, /vendor/lib64]]] couldn’t find “libsqlcipher.so”

The paths its searching suggest you have an x64 .so in your libs output and that is being preferred by the device. To the best of my understanding if you run on an x64 Android device and there are x64 libs it will only load libraries of that type. As SQLCipher is not 64bit it won’t find the libsqlcipher.so in the lib/arm64-v8a directory.

I’ve had this before and the best work around was to exclude all the other x64 .so files so it has no option but to load a different variant supported by SQL Cipher.

In the app build.gradle you need something like this:

packagingOptions {  
exclude ‘lib/arm64-v8a/libRSSupport.so’ // BAD SQLCIPHER FIX  
exclude ‘META-INF/LICENSE’  
}

although it looks like since I have found this fix there might be a better way.

> <https://stackoverflow.com/questions/37382057/android-apk-how-to-exclude-a-so-file-from-a-3rd-party-dependency-using-gradle>

Hope this helps! I only came here to see if there was any developments with 64bit support.
