2

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

Min Soe
  • 1,214
  • 1
  • 14
  • 25

2 Answers2

1

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.

Min Soe
  • 1,214
  • 1
  • 14
  • 25
  • Glad to see you fixed. You can disable `jackOptions`.I thought you added JAVA 8. Read https://developer.android.com/studio/write/java8-support#configure-gradle – IntelliJ Amiya Aug 14 '18 at 07:34
  • 1
    yes. mine was in Gradle 2. after i've upgraded to Gradle 3, I am able to remove `jackOptions` – Min Soe Aug 14 '18 at 07:44
0
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;

DON'T

import android.database.Cursor;

DO

 import net.sqlcipher.Cursor;

You should use

For app/build.gradle section

   compile (name: 'android-database-sqlcipher-3.5.9', ext: 'aar')

Add below project's build.gradle file

  repositories {
     jcenter()
    }

Then File-> Sync Project with Gradle Files & Clean->Rebuild Project.

Read SQLCipher for Android Application Integration

FYI

We initially tested adding Java 8 support via the Jack toolchain. Over time, we realized the cost of switching to Jack was too high for our community when we considered the annotation processors, bytecode analyzers and rewriters impacted. Thank you for trying the Jack toolchain and giving us great feedback. You can continue using Jack to build your Java 8 code until we release the new support. Migrating from Jack should require little or no work.

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198