2016-06-11 13 views
2

Zunächst, da dies meine erste Frage ist, möchte ich hallo an euch alle sagen. Diese Community ist großartig und die Antworten, die ich hier finde, helfen mir jedes Mal, wenn ich etwas schreibe. Dieses Mal nicht.Gradle schlägt fehl, wenn realm-gradle-plugin: 1.0.0 zum Android Studio-Projekt hinzugefügt wurde

Also, ich schreibe kleine App für Android und die Zeit ist gekommen, um Datenbank-Ebene hinzuzufügen. Zu tun, dass ich durch realm installation guide und hinzugefügt, um meine Projekte build.gradle Linie gegangen sind:

classpath "io.realm:realm-gradle-plugin:1.0.0" 

und dann zu meiner App-Modul folgende Zeile build.gradle:

apply plugin: 'realm-android' 

aber hier begannen meine Probleme. Vor der Zugabe dieser beiden Linien gradle wurde die Synchronisierung und Bauvorhaben erfolgreich, aber nach, dass zwei Zeilen hinzugefügt werden nicht mit Fehlermeldung synchronisieren:

Error:Could not find property 'options' on task ':app:compileDebugJavaWithJack'.

Ereignisprotokoll zeigt:

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)

Ich habe versucht, ./gradlew sauber, aber es hat nichts geändert, weder gelöscht .gradle in meinem Home-Verzeichnis und lassen Android Studio Abhängigkeiten von Grund auf behandeln.

Hier build.gradle meines Projekt:

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 
} 

Und build.gradle meiner App-Modul:

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' 
} 

Haben Sie für mich irgendwelche Hinweise, was zu tun ist lässt dieses Projekt bauen?

Vielen Dank im Voraus und Entschuldigung für mein Englisch.

EDIT:
@ cricket_007: oben ist al bekomme ich in Nachrichten Fenster und Ereignisprotokoll. Gradle Konsole ist leer. Aber wenn ich build auf App-Modul build.gradle mit --info Flagge laufen bekomme ich folgende Ausgabe:

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

+0

Können Sie die volle Gradle-Ausgabe anzeigen, nicht nur die letzte Fehlermeldung? –

+0

Das Problem ist übrigens der Jack Compiler, nicht Realm. Zumindest nicht direkt. Realm unterstützt es möglicherweise noch nicht –

+0

Zum Vergleich, hier ist ein ähnliches Problem für die Butterknife-Bibliothek. https://github.com/JakeWharton/butterknife/issues/571 –

Antwort

1
jackOptions { 
     enabled true 
    } 

JACK unterstützt derzeit keine Annotation Processing (verwendet Proxies in Realm zu erzeugen) , aber es erzeugt auch keine Klasse Dateien, die Realm mit Javassist (Bytecode-Manipulation) über den Realm-Transformer verwendet, der alle Feldzugriffe in Proxy-Methodenaufrufe umwandelt.

Es ist eigentlich aus dem Entfernen von obligatorischen Getter/Setter. Aber mit diesem Update kam auch die Fähigkeit, Interfaces auf Realm Objects zu verwenden, also ist es ein wichtiger Schritt.

1

Ich hatte auch das gleiche Problem beim Versuch, Realm zu verwenden, also was ich tat, war nur auf retro-lambda verlassen. Das hat für mich funktioniert.

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 
    } 
} 
Verwandte Themen