Android Studio - 编译debug捅过了, release没有通过


转载请声明,本文来自: https://blog.csdn.net/shijianduan1/article/details/84965508


问题

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
    }
}

分析:
在Android Studio 的Terminal中 执行下面命令,查看具体原因

gradlew lint

命令结果会生成 reports/lint-results-commonRelease-fatal.xml 文件, 查看具体的问题
Android Studio - 编译debug捅过了, release没有通过

根据文件我定位到了代码,下面是我遇到的问题:

Thedimen “layout_height_0” in values-sw360dp has no declaration in th base values folder, this can lead to crashes when the resource is queried in a configuration that does not match this qualifier…
Android Studio - 编译debug捅过了, release没有通过

解决:
很明显, values-sw360dp/dimens.xml 下面定义了一个变量,但是在 values/dimens.xml没有定义。

补上就好