Android: Add failOnWarnings check to android build.gradle and configure lint as warnings as error#12040
Conversation
…re lint as warnings as error
|
@vinodhabib Please review and share feedback on any changes or improvements needed. |
shivaspeaks
left a comment
There was a problem hiding this comment.
You've done both (linter warnings and enabling -Werror) the mentioned issues in this PR. That's fine for me. @ejona86 should be able to tell us if we shouldn't be doing like this.
android/build.gradle
Outdated
| lintOptions { abortOnError true } | ||
|
|
||
| // fail on android lint warnings if failOnWarning is set true | ||
| lintOptions { |
There was a problem hiding this comment.
If we are doing this anyway, lintOptions is deprecated. Use lint instead. (Wait for Eric's comment on this before working)
android/build.gradle
Outdated
| testImplementation libraries.truth | ||
| } | ||
|
|
||
| // Enforce -Werror on java compiler if failOnWarning is set |
There was a problem hiding this comment.
You may remove the comments as they are self explanatory.
|
@ejona86 you're right - lint was an additional improvement, but I missed re-adding the JavaCompile configuration from the original intent of #6868. Initially I assumed that configuring tasks.withType(JavaCompile) globally already applied -Xlint:all and -Werror across all modules. I've now updated the PR to include both the lint block and the JavaCompile warnings, so all modules are covered. Please take another look, thanks! |
ejona86
left a comment
There was a problem hiding this comment.
The build should be failing because of lint warnings. I expect there will be quite a few, which is why I was letting it be done separately.
ejona86
left a comment
There was a problem hiding this comment.
This looks closer, but the build failure looks like it still remains.
|
@Sangamesh1997 For the old Android API targetted error that is causing the build failure, can you try adding the lint.xml exception mentioned here? |
Are you thinking we'd open a new issue to fix that? That is easy to fix, so I don't know why we would silence it instead of just fixing it. I could sort of understand if we want to silence all current lint failures so we stop introducing new ones, but really the warnings I've seen are really old so I was more concerned with fixing them, really. |
|
I assumed we really only cared about the minSdkVersion and that we didn't care about making any API changes needed for the latest Android version available. Now that I think about it I realize it is advantageous to do it rather than not do it , to be compatible with the latest platform advancements. |
|
Generally working with the new platform has been pretty easy for us; bump the number. Our users will be targeting newer versions, so if there is pain, they'd experience that pain. |
Android: Add failOnWarnings check to android build.gradle and configure lint as warnings as error.
Fixes: #6868