Gradle build lintVitalRelease NullPointerException
How to know what's wrong in your code?
Its simple. Open lint-results-release-fatal.html
file in the browser and you will see what is exactly wrong with your code. In my case it was a missing translation.
When I opened the lint-results-release-fatal.html in the browser it looked like this.
How to open lint-results-release-fatal.html in browser?
Go to this path apps/build/reports/lint-results-release-fatal.html right click and Select Open in Browser option. If you don't find it in your project then you can change the perspective to Project.
If you are still confused. Then follow these 3 steps.
1) Change the Prespective to Project
2) Go to apps/build/reports/lint-results-release-fatal.html
3) Right click and select "Open in Browser option"
Missing Translation
As Edward has mentioned that 9/10 times it is due to a missing translation.
In my application, I added multi-language support by creating alternative string.xml files. But forgot to add it in other languages. I got this error when I was trying to create a Signed APK. I had no clue what went wrong until I open the lint-results-release-fatal.html
(Error report).
So in Laymen terms it is just like going through an error report. Which tells you the root cause, source and a possible solution. You can also open the XML version of the error report which is lint-results-release-fatal.xml.
The error report clearly shows that.
<string name="action_settings">Settings</string>
Option 1. Recommended. Fix the issue.
Fix the issue itself instead of disabling it.
To do so go to app/build/outputs/lint-results-release-fatal.html
right click it and select open in browser. Fix the detailed error it provides. I did this, fixed my error and now it compiles the release apk.
Option 2. Disable inspection.
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'.
You should add checkReleaseBuilds
in build.gradle section .
android {
lintOptions {
checkReleaseBuilds false // Add this
abortOnError false
}
}
Then Clean-Rebuild-Run
.