2016-09-25 4 views
1

Ich habe absolut keine Ahnung, was los ist. Ich habe jede einzelne in SO veröffentlichte Lösung ausprobiert, aber das Problem besteht weiterhin.Gradle Build fehlgeschlagen beim Versuch, App zu implementieren

Wenn Gradle Dateien synchronisieren, geht alles glatt:

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies] 

Parallel execution with configuration on demand is an incubating feature. 
:app:preBuild UP-TO-DATE 
:app:preDebugBuild UP-TO-DATE 
:app:checkDebugManifest 
:app:preReleaseBuild UP-TO-DATE 
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE 
:app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE 
:app:prepareComGetkeepsafeRelinkerRelinker121Library UP-TO-DATE 
:app:prepareComJakewhartonButterknife840Library UP-TO-DATE 
:app:prepareIoRealmRealmAndroidLibrary120Library UP-TO-DATE 
:app:prepareDebugDependencies 
:app:compileDebugAidl UP-TO-DATE 
:app:compileDebugRenderscript UP-TO-DATE 
:app:generateDebugBuildConfig UP-TO-DATE 
:app:generateDebugResValues UP-TO-DATE 
:app:generateDebugResources UP-TO-DATE 
:app:mergeDebugResources UP-TO-DATE 
:app:processDebugManifest 
:app:processDebugResources 
:app:generateDebugSources 
:app:preDebugAndroidTestBuild UP-TO-DATE 
:app:prepareDebugAndroidTestDependencies 
:app:compileDebugAndroidTestAidl UP-TO-DATE 
:app:processDebugAndroidTestManifest UP-TO-DATE 
:app:compileDebugAndroidTestRenderscript UP-TO-DATE 
:app:generateDebugAndroidTestBuildConfig UP-TO-DATE 
:app:generateDebugAndroidTestResValues UP-TO-DATE 
:app:generateDebugAndroidTestResources UP-TO-DATE 
:app:mergeDebugAndroidTestResources UP-TO-DATE 
:app:processDebugAndroidTestResources 
:app:generateDebugAndroidTestSources 
:app:mockableAndroidJar UP-TO-DATE 
:app:preDebugUnitTestBuild UP-TO-DATE 
:app:prepareDebugUnitTestDependencies 

BUILD SUCCESSFUL 

Total time: 2.906 secs 

Dann Problem ist, wenn ich den Hit "Play", um die App zu laufen, diese lästigen Fehler ausgelöst:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. 
> java.lang.NullPointerException 

Lauf gradle build --stacktrace in der Konsole, erhalte ich diese Meldung:

FAILURE: Build failed with an exception. 

* Where: 
Build file '.../project-name/app/build.gradle' line: 1 

* What went wrong: 
A problem occurred evaluating project ':app'. 
> Failed to apply plugin [id 'com.android.application'] 
    > Minimum supported Gradle version is 2.14.1. Current version is 2.11. If using the gradle wrapper, try editing the distributionUrl in /Users/jozan/projects/krimturstudios/adventures/gradle/wrapper/gradle-wrapper.properties to gradle-2.14.1-all.zip 

Komisch, ich habe se t grandle 2.11 nirgends .. Es ist immer 2.14.1.

In meinen Android Studio-Einstellungen habe ich die Option "Standard-Wrapper verwenden (empfohlen)" aktiviert.

In meinen Projekteinstellungen habe ich Gradle Version auf 2.14.1 eingestellt.

Das ist mein gradle-wrapper.properties Datei:

distributionBase=GRADLE_USER_HOME 
distributionPath=wrapper/dists 
zipStoreBase=GRADLE_USER_HOME 
zipStorePath=wrapper/dists 
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 

Das ist mein Projekt build.gradle ist Datei:

buildscript { 
    repositories { 
     jcenter() 
    } 

    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.0' 
     classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 
     classpath "io.realm:realm-gradle-plugin:1.2.0" 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

Und das ist meiner app gradle.build Datei:

apply plugin: "com.android.application" 
apply plugin: "android-apt" 
apply plugin: "realm-android" 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.2" 

    defaultConfig { 
     applicationId "..." 
     minSdkVersion 17 
     targetSdkVersion 24 
     versionCode 1 
     versionName "0.2" 
    } 

    buildTypes { 
     debug { 
      applicationIdSuffix ".debug" 
     } 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 
     } 
    } 
} 

dependencies { 
    // Local 
    compile fileTree(include: ["*.jar"], dir: "libs") 

    // Testing 
    testCompile "junit:junit:4.12" 

    // Android 
    compile "com.android.support:appcompat-v7:24.2.1" 
    compile "com.android.support:support-v4:24.2.1" 

    // Butterknife 
    compile "com.jakewharton:butterknife:8.4.0" 
    apt "com.jakewharton:butterknife-compiler:8.4.0" 
} 

Bitte jemand, das macht mich verrückt!

Antwort

0

In cmd Typ Gradlew. Es sollte 2.14 Version herunterladen.

+0

bash: gradlew: Befehl nicht gefunden – josemigallas

+0

Geben Sie es in den Projektordner ein. Es sollte gradlew und gradlew.bat Dateien geben – Mistic92

+0

Sorry, ich habe es nicht korrekt geschrieben "./gradlew". Problem weiterhin besteht noch :( – josemigallas

0

Nachdem ich meinen Repo gelöscht und geklont habe und jede Änderung Schritt für Schritt hinzugefügt habe, habe ich das Problem gelöst.

Weder Gradle noch Android Studio verursachten das, aber Realm!.

Ich hatte dieses Feld in einem Modell der Klasse deklariert:

private RealmList<? extends Item> items; 

, die irgendwie gradle daran hindert, richtig zu sein bauen. Entfernen ermöglicht das Erstellen und Bereitstellen.

Das lustige ist, dass Realm mir keinen Fehler oder Warnung wirft ... Vielleicht ein Fehler.

Verwandte Themen