Lint found fatal errors while assembling a release target

Posted in :

在 Android Studio 打包程式是出現錯誤訊息:

Execution failed for task ':app:lintVitalRelease'.
> A failure occurred while executing com.android.build.gradle.internal.lint.AndroidLintTask$AndroidLintLauncherWorkAction
   > There was a failure while executing work items
      > A failure occurred while executing com.android.build.gradle.internal.lint.AndroidLintWorkAction
         > Lint found fatal errors while assembling a release target.

執行畫面:

解法:

實際去 build 資料夾下,並沒有 report 的資料夾,但使用 Analyze > Inspect Code  的確可以看到很多神奇的錯誤與 Warring. 逐一的修改後,就不需使用 lintOptions 來解決。

  1. You can use Analyze > Inspect Code menu to manually run inspections. The results appear in the Inspection Results window. This way you can view and fix the real issues.
  2. You can still view them from app\build\reports\lint-results-release-fatal.html file without using aforementioned manual inspection menu.
  3. Although it’s not recommended you can also suppress the lint warnings by adding below code into your build.gradle as Android Studio suggests. But keep in mind that this will not fix any real issues.
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
    }
}


資料來源

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *