使用gradle build android应用程序时,Lint失败 [英] Lint failed when using gradle build android app

查看:107
本文介绍了使用gradle build android应用程序时,Lint失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I created an app with android studio, but every time I try to use command gradle build to build the application, it says "lint failed". When I checked the debug info of gradle build, it said:

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)



<我搜查了很多,但找不到解决方案。
任何人都可以帮忙吗?

I have searched a lot but could not find a solution for it. Anyone can help about it? Thank in advance.

推荐答案

我通过添加 lintOptions 来解决同样的问题。在build.gradle中:

I fixed the same issue by adding lintOptions in build.gradle :

android {

    lintOptions {
        abortOnError false
    }
}

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

IntelliJ hinted : Fix the issues identified by lint, or add the following to your build script to proceed with errors:

这篇关于使用gradle build android应用程序时,Lint失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆