question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Snackbar] Gradle lint task fails inconsistently: WrongConstant

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:20
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ataraxuscommented, Sep 16, 2020

+1 same issue material version: 1.1.0, 1.2.0 API: 29 Gradle 4.0.1

Workaround: lintOptions { disable ‘WrongConstant’ } thx: @azaricstefan

1reaction
drchencommented, Feb 9, 2022

Thank you so much for the confirmation. If that’s the case I guess the issue was solved even before the commit I linked. : )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lint fails the build with Security error "WrongConstant
I know that this error can be simply suppressed. But I'd like to know what's wrong with my code? Or maybe it's another...
Read more >
Android Gradle Build & Analyze failed on Lint errors
2] FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:lintDebug'. > Lint found errors in the project; ......
Read more >
Finding Unused Gradle Dependencies - Baeldung
Learn how to use the Gradle Nebula Lint plugin to identify and fix unused ... gradlew lintGradle > Task :lintGradle FAILED # failure...
Read more >
Android User Guide - Google Samples
The Gradle plugin now maps the lint task to the default variant's lint task instead of running it ... Set the exit code...
Read more >
Improve your code with lint checks - Android Developers
Run lint from the command line. If you're using Android Studio or Gradle, you can use the Gradle wrapper to invoke the lint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found