androidandroid-studiosqlcipher-android

Java.lang.UnsatisfiedLinkError: couldn't find "libstlport_shared.so


I am very new to SQL Cipher. I read many stuff and implemented SQLCipher into my project.

I have put below JAR files into app/src/libs

I have put below file into app/src/main/assets

I have put below file into app/src/main/jniLibs

  1. In Folder: armeabi

    • libdatabase_sqlcipher.so
    • libsqlcipher_android.so
    • libstlport_shared.so
  2. In Folder: armeabi-v7a

    • libdatabase_sqlcipher.so
    • libsqlcipher_android.so
    • libstlport_shared.so
  3. In Folder: x86

    • libdatabase_sqlcipher.so
    • libsqlcipher_android.so
    • libstlport_shared.so

Below my gradle file in android studio.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "abc.com.sqlcipher"
        minSdkVersion 10
        targetSdkVersion 22
        versionCode 1
       versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'
}

After this, i run my application and it gets crash every time with below error.

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/abc.com.sqlcipher-1/base.apk"],nativeLibraryDirectories=[/data/app/abc.com.sqlcipher-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "liblibstlport_shared.so"

Solution

  • After 4 to 5 hours, i got the solution from one of my friend.

    Write below code into build.gradle file before android{} block.

    repositories {
        maven {
            url "https://s3.amazonaws.com/repo.commonsware.com"
        }
    }
    

    Write below line into dependencies {} block.

    compile 'com.commonsware.cwac:sqlcipher-for-android:3.3.1'
    

    Now you Sync your project then you can use SQL-Cipher Database into your application eaisly.