在根项目'myapplication'中找不到任务'选项'

时间:2015-12-31 05:17:53

标签: android android-gradle build.gradle

我收到此错误,但未了解代码中的确切错误。从2天开始我试图解决这个错误但是在通过项目重建时无法获得此错误的确切解决方案我刚刚添加了一个jar文件init并试图将我的程序添加到git中,但是失败了。

    Error:10:20:14.170 [ERROR] [org.gradle.BuildExceptionReporter] 
10:20:14.170 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
10:20:14.170 [ERROR] [org.gradle.BuildExceptionReporter] 
10:20:14.170 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
10:20:14.171 [ERROR] [org.gradle.BuildExceptionReporter] Task 'option' not found in root project 'Design'.
10:20:14.171 [ERROR] [org.gradle.BuildExceptionReporter] 
10:20:14.171 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
10:20:14.171 [ERROR] [org.gradle.BuildExceptionReporter] Run gradle tasks to get a list of available tasks. 
10:20:14.171 [ERROR] [org.gradle.BuildExceptionReporter] 
10:20:14.171 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
10:20:14.172 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.execution.TaskSelectionException: Task 'option' not found in root project 'Design'.
10:20:14.172 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:100)
10:20:14.172 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:75)
10:20:14.172 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.commandline.CommandLineTaskParser.parseTasks(CommandLineTaskParser.java:42)
10:20:14.173 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:44)
10:20:14.173 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
10:20:14.173 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
10:20:14.173 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
10:20:14.173 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:47)
10:20:14.174 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
10:20:14.174 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
10:20:14.174 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
10:20:14.174 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:44)
10:20:14.174 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
10:20:14.174 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.select(DefaultBuildExecuter.java:35)
10:20:14.174 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
10:20:14.175 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
10:20:14.175 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
10:20:14.175 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
10:20:14.175 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
10:20:14.175 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
10:20:14.175 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
10:20:14.176 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
10:20:14.176 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:49)
10:20:14.176 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
10:20:14.176 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.176 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
10:20:14.176 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.176 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
10:20:14.177 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.177 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
10:20:14.177 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.177 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
10:20:14.177 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
10:20:14.177 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.util.Swapper.swap(Swapper.java:38)
10:20:14.178 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
10:20:14.178 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.178 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
10:20:14.178 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.178 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
10:20:14.178 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
10:20:14.179 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.179 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
10:20:14.179 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
10:20:14.179 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.179 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
10:20:14.179 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
10:20:14.180 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
10:20:14.180 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
10:20:14.180 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
10:20:14.180 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
10:20:14.180 [ERROR] [org.gradle.BuildExceptionReporter] 

的build.gradle(模块):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "com.sun.suni.design"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'it.neokree:MaterialTabs:0.11'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.android.support:design:23.1.1'
    compile files('libs/carousel-api-v1.jar')
}

的build.gradle(项目)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

1 个答案:

答案 0 :(得分:0)

我通过修改设置 - 编译器 - 命令行选项来解决问题: 从 - 调试选项 - stacktrace --debug