Reputation: 182
First of all, as this is my first question, I'd like to say hallo to all of you. This community is awesome and answers I'm finding here help me every time I'm coding. Not this time.
So, I'm writing small app for Android and time has come to add database layer. To do that I've gone through realm installation guide and added to my projects build.gradle line:
classpath "io.realm:realm-gradle-plugin:1.0.0"
and then following line to my app module build.gradle:
apply plugin: 'realm-android'
but here my problems started. Before adding these two lines gradle was syncing and building project successfully, but after that two lines being added it fails to sync with error message:
Error:Could not find property 'options' on task ':app:compileDebugJavaWithJack'.
Event log shows:
17:24:48 Gradle sync started
17:24:50 Gradle sync failed: Could not find property 'options' on task ':app:compileDebugJavaWithJack'. Consult IDE log for more details (Help | Show Log)
I've tried ./gradlew clean but it didn't change anything, neither did deleting .gradle in my home directory and letting Android Studio handle dependencies from scratch.
Here's my project's build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath "io.realm:realm-gradle-plugin:1.0.0"
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my app module's build.gradle:
apply plugin: 'com.android.application' //
apply plugin: 'realm-android'
android {
compileSdkVersion 23
//compileSdkVersion 'android-N'
//buildToolsVersion "23.0.3"
buildToolsVersion "24.0.0-rc4"
defaultConfig {
applicationId "agh.jitp2.quizzy"
minSdkVersion 21
targetSdkVersion 23
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'])
testCompile 'junit:junit:4.12'
testCompile 'org.assertj:assertj-core:3.4.1'
testCompile 'org.mutabilitydetector:MutabilityDetector:0.9.5'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
}
Do you have any hints for me what needs to be done to make this project being built?
Thanks in advance and sorry for my English.
EDIT:
@cricket_007: above is al I get in messages window and Event log. Gradle Console is empty. But when I run build on app module build.gradle with --info flag I get following output:
[...]
Starting Build
Settings evaluated using settings file 'C:_Dev_Repos\AGH\Quizzy\settings.gradle'.
Projects loaded. Root project using build file 'C:_Dev_Repos\AGH\Quizzy\build.gradle'.
Included projects: [root project 'Quizzy', project ':app']
Evaluating root project 'Quizzy' using build file 'C:_Dev_Repos\AGH\Quizzy\build.gradle'.
Evaluating project ':app' using build file 'C:_Dev_Repos\AGH\Quizzy\app\build.gradle'.
Creating configuration compile
Creating configuration apk
Creating configuration provided
Creating configuration wearApp
Creating configuration androidTestCompile
Creating configuration androidTestApk
Creating configuration androidTestProvided
Creating configuration androidTestWearApp
Creating configuration testCompile
Creating configuration testApk
Creating configuration testProvided
Creating configuration testWearApp
Creating configuration debugCompile
Creating configuration debugApk
Creating configuration debugProvided
Creating configuration debugWearApp
Creating configuration testDebugCompile
Creating configuration testDebugApk
Creating configuration testDebugProvided
Creating configuration testDebugWearApp
Creating configuration releaseCompile
Creating configuration releaseApk
Creating configuration releaseProvided
Creating configuration releaseWearApp
Creating configuration testReleaseCompile
Creating configuration testReleaseApk
Creating configuration testReleaseProvided
Creating configuration testReleaseWearApp
Parsing the SDK, no caching allowed
Parsing C:_Dev\Android\SDK\add-ons\addon-google_apis-google-23\package.xml
Parsing C:_Dev\Android\SDK\build-tools\23.0.3\package.xml
Parsing C:_Dev\Android\SDK\build-tools\24.0.0-preview\package.xml
Parsing C:_Dev\Android\SDK\docs\package.xml
Parsing C:_Dev\Android\SDK\extras\android\m2repository\package.xml
Parsing C:_Dev\Android\SDK\extras\google\m2repository\package.xml
Parsing C:_Dev\Android\SDK\extras\google\usb_driver\package.xml
Parsing C:_Dev\Android\SDK\extras\intel\Hardware_Accelerated_Execution_Manager\package.xml
Parsing C:_Dev\Android\SDK\platform-tools\package.xml
Parsing C:_Dev\Android\SDK\platforms\android-23\package.xml
Parsing C:_Dev\Android\SDK\platforms\android-N\package.xml
Parsing C:_Dev\Android\SDK\sources\android-23\package.xml
Parsing C:_Dev\Android\SDK\system-images\android-23\google_apis\x86\package.xml
Parsing C:_Dev\Android\SDK\tools\package.xml
Incremental Java compilation disabled in variant debug as you are using an incompatible plugin
Not using incremental javac compilation.
Incremental java compilation is an incubating feature.
Incremental Java compilation disabled in variant debugUnitTest as you are using an incompatible plugin
Not using incremental javac compilation.
Incremental Java compilation disabled in variant release as you are using an incompatible plugin
Not using incremental javac compilation.
Incremental Java compilation disabled in variant releaseUnitTest as you are using an incompatible plugin
Not using incremental javac compilation.FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
> Could not find property 'options' on task ':app:compileDebugJavaWithJack'.Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.BUILD FAILED
Upvotes: 2
Views: 1754
Reputation: 2767
I also had the same issue when trying to use Realm, so what I did was just to rely on retro-lambda. That worked for me.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
}
}
// Required because retrolambda is on maven central
repositories {
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'me.tatarka.retrolambda'
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Upvotes: 1
Reputation: 81588
jackOptions {
enabled true
}
JACK currently does not support annotation processing (used to generate proxies in Realm), but it also doesn't generate class files which Realm uses with Javassist (bytecode manipulation) through the Realm-Transformer which turns all field access into proxy method calls.
It's for the sake of removing mandatory getter/setters, actually. But with that update, also came the ability to use interfaces on Realm Objects, so it's a kinda important step.
Upvotes: 1