天天看點

Android 打release包異常 Lint found fatal errors while assembling a release target.

運作debug時沒有出現問題,但是打包過程中出現異常,

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

這個錯誤的出現那肯定是代碼中有異常,不規範,但是不影響運作。如果隻想編譯通過,可以按照上面的提示,在build.gradle檔案中,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
    }
           

但是不建議這樣做,這隻是關閉了lint checkReleaseBuilds 的檢查,異常依然存在。

最根本的解決方法還是找到異常所在:

在項目的build檔案夾下找到這兩個檔案:

Android 打release包異常 Lint found fatal errors while assembling a release target.

兩個檔案都可以,不過lint-results-resease-fatal.html可以直覺的查找到異常資訊:

Android 打release包異常 Lint found fatal errors while assembling a release target.