使用gradle build android app时Lint失败了

时间:2014-05-07 13:19:31

标签: android gradle android-studio lint

我用android studio创建了一个应用程序,但每次我尝试使用命令gradle build来构建应用程序时,都会说“lint failed”。当我检查gradle build的调试信息时,它说:

21:10:26.215 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon,5,main]] finished, busy: 1.263 secs, idle: 0.034 secs
21:10:26.219 [ERROR] [org.gradle.BuildExceptionReporter] 
21:10:26.221 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
21:10:26.222 [ERROR] [org.gradle.BuildExceptionReporter] 
21:10:26.222 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
21:10:26.223 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':MyApp:lint'.
21:10:26.224 [ERROR] [org.gradle.BuildExceptionReporter] > class org.objectweb.asm.tree.ClassNode has interface org.objectweb.asm.ClassVisitor as super class
21:10:26.225 [ERROR] [org.gradle.BuildExceptionReporter] 
21:10:26.226 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
21:10:26.228 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':MyApp:lint'.
21:10:26.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
21:10:26.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
21:10:26.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
21:10:26.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
21:10:26.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
21:10:26.232 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
21:10:26.233 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
21:10:26.233 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
21:10:26.234 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
21:10:26.235 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
21:10:26.235 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
21:10:26.236 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
21:10:26.237 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
21:10:26.237 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
21:10:26.237 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
21:10:26.238 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
21:10:26.238 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
21:10:26.239 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
21:10:26.239 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

我搜索了很多但找不到解决方法。 有人可以帮忙吗?提前谢谢。

1 个答案:

答案 0 :(得分:7)

我通过在build.gradle中添加lintOptions修复了同样的问题:

android {

    lintOptions {
        abortOnError false
    }
}

IntelliJ暗示: 修复lint标识的问题,或将以下内容添加到构建脚本中以继续处理错误: