material-components-android: [Snackbar] Gradle lint task fails inconsistently: WrongConstant
Description:
./gradlew lint would fail on Material v1.1.0-alpha07 and before, and Android Studio would show a lint error for Snackbar.make(view, "Replace with your own action", BaseTransientBottomBar.LENGTH_LONG) with a WrongConstant error. (Snackbar.LENGTH_LONG should be used instead.)
On v1.1.0-alpha08 and v1.1.0-alpha09 ./gradlew lint fails sometimes (about half the time) and the Android Studio lint error is no longer shown. This also happens on v1.2.0-alpha03.
Expected behavior:
The Gradle lint task fails or succeeds consistently and Android Studio’s linter reflects this success/failure.
Source code:
Snackbar.make(view, "Replace with your own action", BaseTransientBottomBar.LENGTH_LONG)
Android API version:
28
Material Library version:
OK: v1.1.0-alpha-07 and earlier Not OK: v1.1.0-alpha08, v1.1.0-alpha09, v1.2.0-alpha03
Device:
N/A
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 20
- Comments: 23 (4 by maintainers)
+1 same issue material version: 1.1.0, 1.2.0 API: 29 Gradle 4.0.1
Workaround: lintOptions { disable ‘WrongConstant’ } thx: @azaricstefan
Thank you so much for the confirmation. If that’s the case I guess the issue was solved even before the commit I linked. : )
I can’t reproduce this in my old project, back when I had this issue and reported it. That project had too many dependencies back then that are now obsolete, which makes it impossible to build it at all. Currently the project depends on Material 1.4.0 and that doesn’t seem to have this issue. I tried 20 builds without suppressing the lint error and they all passed.