# Cipher problem with Android 8

**URL:** <https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121>\
**Category:** SQLCipher\
**Created:** [September 27, 2018, 3:47pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121 "2018-09-27T15:47:05Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![bahmanbj](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bahmanbj](https://discuss.zetetic.net/u/bahmanbj)\
**Post date:** [September 27, 2018, 3:47pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/1 "2018-09-27T15:47:05Z")

</div>

Hello,  
In an Android app compiled by SDK 19, Cipher works perfect, but as Google asked to set Target SDK to 26, I got Error Code 14 as Couldn’t open database after changed compile and target SDk to 26.  
Application has been set up in Android Studio 3.0.1 and Cipher version is 3.5.9.  
Any idea, whats going wrong?  
Thank you.  
Bahman

---

<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:** [September 27, 2018, 5:15pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/2 "2018-09-27T17:15:20Z")

</div>

Hello @bahmanbj

I just recently bumped the target SDK version of SQLCipher for Android to 26, then ran the library against the SQLCipher for Android [test suite](https://github.com/sqlcipher/sqlcipher-android-tests) without issue. Is it possible that you provided an invalid password to the database? Can you pull the database off device and test access with the SQLCipher command line shell?

---

<div class="post-metadata">

**Author:** ![bahmanbj](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bahmanbj](https://discuss.zetetic.net/u/bahmanbj)\
**Post date:** [September 27, 2018, 7:18pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/3 "2018-09-27T19:18:39Z")

</div>

You imported aar file directly in the project, mine uses :  
compile ‘net.zetetic:android-database-sqlcipher:3.5.9@aar’  
in dependocies in build.gradle.  
It is same project, same database so I didn’t touch password.  
It is working perfect on SDK19, When I change SDK to 26, problem appears.  
I tried your way to import module for aar file, but it says “Error Failed to resolve aar file”  
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:** [September 27, 2018, 9:40pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/4 "2018-09-27T21:40:51Z")

</div>

Hi @bahmanbj

It sounds as if your project configuration may be of issue since it isn’t able to locate the local AAR file. Did you build the AAR yourself? You might want to refer to how we include the local AAR [here](https://github.com/sqlcipher/sqlcipher-android-tests/blob/master/app/build.gradle#L21-L29).

---

<div class="post-metadata">

**Author:** ![bahmanbj](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bahmanbj](https://discuss.zetetic.net/u/bahmanbj)\
**Post date:** [October 2, 2018, 3:36pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/5 "2018-10-02T15:36:14Z")

</div>

Hi,  
Yes you are right.  
It seems the problem comes from the new permission way which Android 8 forced to follow and how I got file path from external storage which has been changed in Android 8.  
I setup a checkSelfPermission and could connect and do a query from database under Cipher.  
Thank you.  
Bahman

---

<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:** [October 2, 2018, 4:37pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/6 "2018-10-02T16:37:04Z")

</div>

Hi @bahmanbj

We are happy to hear you were able to resolve the issue. Take care!

---

<div class="post-metadata">

**Author:** ![Sri\_z\_Ravindran](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Sri\_z\_Ravindran](https://discuss.zetetic.net/u/Sri_z_Ravindran)\
**Post date:** [November 13, 2018, 8:20am UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/7 "2018-11-13T08:20:33Z")

</div>

Hi @developernotes, I am still facing the above issue, where the application is working fine with API 22 but not with API 26. In API 22 it’s working fine but getting a warning message as “libsqlcipher\_android.so has text relocations. This is wasting memory and prevents security hardening. Please fix.”

Which is the actual problem when the API is changed to 26. where I get the error message as “java.lang.UnsatisfiedLinkError: dlopen failed: libstlport\_shared.so: has text relocations”.

---

<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 13, 2018, 2:19pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/8 "2018-11-13T14:19:35Z")

</div>

Hello @Sri_z_Ravindran

> [@Sri\_z\_Ravindran](#):
>
> In API 22 it’s working fine but getting a warning message as “libsqlcipher\_android.so has text relocations. This is wasting memory and prevents security hardening. Please fix.”
> 
> Which is the actual problem when the API is changed to 26. where I get the error message as “java.lang.UnsatisfiedLinkError: dlopen failed: libstlport\_shared.so: has text relocations”.

Both these comments suggest you are using a much older SQLCipher for Android library. The native library filename’s have changed, and the text relocation issues have been resolved in newer builds. Please upgrade to the latest build of the library, and removing the old library artifacts from your project. Thanks!

---

<div class="post-metadata">

**Author:** ![Sri\_z\_Ravindran](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Sri\_z\_Ravindran](https://discuss.zetetic.net/u/Sri_z_Ravindran)\
**Post date:** [November 13, 2018, 2:32pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/9 "2018-11-13T14:32:52Z")

</div>

Hi @developernotes thanks for your reply. Can you kindly tell where the latest build of the library is?

---

<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 13, 2018, 2:45pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/10 "2018-11-13T14:45:00Z")

</div>

Hi @Sri_z_Ravindran

If you have licensed the commercial edition of the library, please reach out to us at [support@zetetic.net](mailto:support@zetetic.net). If you are using the community edition of the library, you can read more information [here](https://www.zetetic.net/sqlcipher/sqlcipher-for-android/) about the latest package.

---

<div class="post-metadata">

**Author:** ![Sri\_z\_Ravindran](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Sri\_z\_Ravindran](https://discuss.zetetic.net/u/Sri_z_Ravindran)\
**Post date:** [November 13, 2018, 2:58pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/11 "2018-11-13T14:58:37Z")

</div>

Thanks @developernotes. I tried with community edition, when I try to add the compile in the app/build.gradle. I am getting Failed to resolve “net.zetetic:android-database-sqlcipher:3.5.9@aar”. and the gradle build is getting failed.

---

<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 13, 2018, 8:54pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/12 "2018-11-13T20:54:34Z")

</div>

Hello @Sri_z_Ravindran

That maybe a project configuration issue. Make sure you have your Gradle configuration setup to resolve packages from Maven Central. [Here](https://search.maven.org/artifact/net.zetetic/android-database-sqlcipher/3.5.9/aar) is the publish artifact.

---

<div class="post-metadata">

**Author:** ![Sri\_z\_Ravindran](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Sri\_z\_Ravindran](https://discuss.zetetic.net/u/Sri_z_Ravindran)\
**Post date:** [November 16, 2018, 4:11am UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/13 "2018-11-16T04:11:20Z")

</div>

Hi @developernotes. Thanks for the reply. May I know the files that needs to be deleted before, to make the compile command run, Since I have sql cipher already but I need to update. Still getting “Failed to resolve “net.zetetic:android-database-sqlcipher:3.5.9@aar””

---

<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, 2018, 2:10pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/14 "2018-11-16T14:10:11Z")

</div>

Hi @Sri_z_Ravindran

If you have an installation from over 2 years ago, you will want to remove `libdatabase_sqlcipher.so` , `libsqlcipher_android.so` , and `libstlport_shared.so` per platform folder. In addition to the different native libraries, you should also remove the ICU zip file (i.e., `icudt46l.zip` ) previously included within the assets directory of your application.

---

<div class="post-metadata">

**Author:** ![Sri\_z\_Ravindran](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Sri\_z\_Ravindran](https://discuss.zetetic.net/u/Sri_z_Ravindran)\
**Post date:** [November 16, 2018, 2:22pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/15 "2018-11-16T14:22:41Z")

</div>

Thanks a lot Nick. It’s working fine now.😄

---

<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, 2018, 2:42pm UTC](https://discuss.zetetic.net/t/cipher-problem-with-android-8/3121/16 "2018-11-16T14:42:31Z")

</div>

Hi @Sri_z_Ravindran

Great, we are happy to hear everything is working well for you now!
