Cipher problem with Android 8

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

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 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?

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

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.

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

Hi @bahmanbj

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

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”.

Hello @Sri_z_Ravindran

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!

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

Hi @Sri_z_Ravindran

If you have licensed the commercial edition of the library, please reach out to us at support@zetetic.net. If you are using the community edition of the library, you can read more information here about the latest package.

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.

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 is the publish artifact.

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””

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.

Thanks a lot Nick. It’s working fine now.:smile:

Hi @Sri_z_Ravindran

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