为什么我的 Travis-CI 构建仍然失败?

Why is my Travis-CI build still failing?

最后四个版本都失败了,但我不明白为什么。它给我一个错误,但是当我检查 IDE (Android Studio 中的代码时,我没有错误,只有警告。是否将警告解释为错误?这是日志给出的错误:

Lint found 1 errors and 6 warnings
:mobile:lint FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mobile:lint'.
> Lint found errors in the project; aborting build.

这是因为您的 gradle 配置为如果您的代码不匹配 LINT 规则则构建失败。

您可以尝试以下任一方法:

  1. 修复代码中 LINT 抱怨的所有内容(最推荐)

  2. 通过将安静模式或 abortOnError 设置为 false 来使 lint 静音:


lintOptions {
        quiet true
        checkReleaseBuilds false
        // if true, stop the gradle build if errors are found
        abortOnError false
    } </pre>

  1. 在任务开始时禁用所有以 lint 开头的 gradle 任务


tasks.whenTaskAdded { task ->
    if (task.name.equals("lint")) {
        task.enabled = false
    }
} </pre>

  1. 运行 带有 -x lint 参数的构建任务,例如:gradlew assemble -x lint