Search code examples
androidandroid-studiosqlciphercannot-find-symbolsqlcipher-android

Cannot resolve symbol 'database' in net.sqlcipher import in Android Studio


Any idea why I am having this cannot resolve symbol 'database' in net.sqlcipher. I simply cloned SQLCipher Android Test from GitHub and wanted to test.

have also attached the screenshot for reference. enter image description here

Thank you...


Solution

  • I am able to compile now after I've added compileOptions as JavaVersion 8 and enabled JACK

    compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
    }
    

    Jack Options is added inside defaultConfig

    jackOptions {
      enabled true
    }
    

    Now my app/build.gradle has become like this.

    apply plugin: 'com.android.application'
    
    android {
      compileSdkVersion 26
      buildToolsVersion "26.0.1"
      defaultConfig {
        applicationId "net.zetetic.sqlcipher.test"
        minSdkVersion 14
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        jackOptions {
         enabled true
        }
     }
    buildTypes {
     release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
     }
    }
    
    compileOptions {
     sourceCompatibility JavaVersion.VERSION_1_8
     targetCompatibility JavaVersion.VERSION_1_8
    }
    }
    
    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    
    // For testing zip-based distributions:
    //compile files('libs/sqlcipher.jar')
    
    
     // For testing AAR packages:
     compile 'net.zetetic:android-database-sqlcipher:3.5.9@aar'
    }
    

    Thanks a lot for your helps guys.