不能跑gradle

时间:2014-10-23 08:00:30

标签: android gradle android-gradle gradlew

我尝试了很多不同的东西,例如升级gradle,但我无法解决这个问题。我无法跑步:

./gradlew build --stacktrace
:......
:app:compileDebugJava
An exception has occurred in the compiler (1.8.0_25). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for bolts.Task not found
:app:compileDebugJava FAILED

FAILURE: Build failed with an exception.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJava'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)

这是我的应用> gradle.build

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "21.0.2"


    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src/main/java']
            resources.srcDirs = ['src/main']
            //aidl.srcDirs = ['src/main']
            renderscript.srcDirs = ['src/main']
            res.srcDirs = ['src/main/res']
            //assets.srcDirs = ['assets']
        }
    }
    productFlavors {
    }
}

dependencies {
    compile 'com.android.support:support-v4:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

这是我的根> gradle.build

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.13.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

我也尝试过这个指南,但它不适合我:Gradle build not working: Execution failed for task ':MyApp:compileDebug'

1 个答案:

答案 0 :(得分:5)

您的错误提到螺栓缺失:

  

bolt的类文件。找不到任务

尝试通过以下方式将其添加到您的依赖项中:

  

compile'c​​om.parse.bolts:bolts-android:1。+'