如何在Android Studio v3.1.1中生成build apk时修复checkReleaseBuilds false

时间:2018-04-22 17:16:15

标签: java android android-studio-3.0

我在 Android studio v3.1.1 中开发了一个Android应用程序 我的项目已经完成,我希望生成apk 来自构建 - >生成Build Apk ,但在第二次显示Logcat下面的错误:

Lint found fatal errors while assembling a release target.

To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}
...

我该如何解决?请帮帮我

3 个答案:

答案 0 :(得分:4)

在您应用的lintOptions中添加以下build.gradle数据块。

android {
    defaultConfig {
        ...
    }

    buildTypes {
        ...
    }

    lintOptions {
        // Returns whether lint should be quiet (for example, not write informational messages such as paths to report files written)
        quiet true

        // Whether lint should set the exit code of the process if errors are found
        abortOnError false

        // Returns whether lint will only check for errors (ignoring warnings)
        ignoreWarnings true

        // Returns whether lint should check for fatal errors during release builds. Default is true.
        // If issues with severity "fatal" are found, the release build is aborted.
        checkReleaseBuilds false
    }
}

答案 1 :(得分:0)

您收到的信息告诉您需要知道的一切。修复导致此消息的lint错误(请查看文档here以了解如何运行lint以及在何处查找包含详细信息的完整报告),或将checkReleaseBuilds false添加到lintOptions在build.gradle文件中阻止。

答案 2 :(得分:0)

在应用的build.gradle中添加以下lintOptions块

 lintOptions {
        checkReleaseBuilds false
  }