':app:lintVitalRelease' error when generating signed apk

Solution 1:

I wouldn't recommend turning off the lint checks, they're there for a reason. Instead, check what the error is and fix it.

The error report is saved to [app module]/build/reports/lint-results-yourBuildName-fatal.html. You can open this file in a browser to read about the errors.

It would be nice if Gradle could make it a little more clear where the error report is generated.

Solution 2:

I had this problem and solved it by adding:

lintOptions { 

    checkReleaseBuilds false

}

to my build.gradle file within the android{ } section.       

Solution 3:

if you want to find out the exact error go to the following path in your project: /app/build/reports/lint-results-release-fatal.html(or .xml). The easiest way is if you go to the xml file, it will show you exactly what the error is including its position of the error in your either java class or xml file. Turning off the lint checks is not a good idea, they're there for a reason. Instead, go to:

    /app/build/reports/lint-results-release-fatal.html or 
    /app/build/reports/lint-results-release-fatal.xml

and fix it.

In Kotlin is different. First you need to set the following code in Android section of build.gradel of the app folder.

     android {
          :
          lintOptions {
            baseline(file("lint-baseline.xml"))
          }
      }

Then run lint from the IDE (Analyze > Inspect Code) or from the command line as follows.

      $ ./gradlew lintDebug

...

The output prints the location of the lint-baseline.xml file within app folder but sometimes within app/src folder as well /app/lint-baseline.xml