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

3

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Glad to see you fixed. You can disable jackOptions.I thought you added JAVA 8. Read developer.android.com/studio/write/…
yes. mine was in Gradle 2. after i've upgraded to Gradle 3, I am able to remove jackOptions
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
}

5 Comments

oh, I am still using older version of Gradle. so it's compile 'net.zetetic:android-database-sqlcipher:3.5.9@aar instead of implementation. The rest is the same.
@MinSoe at first import import net.sqlcipher.Cursor;
it's the same. there's nothing under net.sqlcipher
@MinSoe add compile (name: 'android-database-sqlcipher-3.5.9', ext: 'aar')
@MinSoe After change Restart your IDE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.