3

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

  • commons-codec.jar
  • guava-r09.jar
  • sqlcipher.jar
  • sqlcipher-javadoc

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

  • icudt46l.zip

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"
halfer
  • 19,824
  • 17
  • 99
  • 186
Ram Mansawala
  • 652
  • 7
  • 22

1 Answers1

3

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.

James Warner
  • 385
  • 2
  • 14
Ram Mansawala
  • 652
  • 7
  • 22
  • Still getting error, and i am using this lib for sqlcipher compile 'net.zetetic:android-database-sqlcipher:3.4.0@aar' – Krunal Shah Jun 17 '16 at 11:43
  • Hi so can you tell me that we need to with sqlcipher.jar do we need to remove it and import all class of commonsware ? – Nikunj Patel Jun 24 '16 at 11:30
  • @NikunjPatel i do not have idea about it. but you can ask question here https://discuss.zetetic.net/ – Ram Mansawala Jun 28 '16 at 17:31
  • No, but you have implemented so I want idea..so Logically so file I think need to remove and that jar also need to remove and then need to check with Commonsware. – Nikunj Patel Jun 29 '16 at 07:33
  • This solution is incorrect. I am using: compile 'net.zetetic:android-database-sqlcipher:3.5.4@aar' but still getting that error. – Davoud Dec 13 '16 at 10:05