PSA: You can now build with stable and lint with canaries

Skip to first unread message

Tor Norbye

Aug 2, 2021, 6:46:04 PM8/2/21
to lint-dev
Lint went through a bunch of big changes in 7.0, so definitely check out the change notes.

However, I want to call special attention to one thing: you can now build with a stable version of AGP (from 7.0 and up), but use a newer of lint to check your code!

This solves a problem we've often heard where users want or need to stick with an older version of lint (or can't update yet due to some sort of plugin incompatibility), but would still like to try a newer version of lint -- to get the latest fixes, or new lint checks, or better performance, etc.

Here's how it works. Let's say your project is configured to build with AGP 7.0.0.
In your

android.experimental.lint.version = 7.1.0-alpha05

Now, when you run ./gradlew :app:lint the project will first be built using 7.0.0, but when it gets to the part where it's about to run the lint code, it will resolve the 7.1.0-alpha05 dependency instead and use that version of lint! This works because lint now no longer is residing directly inside the Android gradle plugin; instead, there is code there which populates descriptors for everything lint needs and then invokes lint (and here, a newer lint!) pointing to that model.

There are more details about this here:

-- Tor

P.S. Lint will also add a warning if there's a more recent version of lint available than the one you're pointing to via the property!

Drew Hannay

Sep 8, 2021, 6:05:21 PM9/8/21
to lint-dev
It looks like using this with a project that builds with AGP 7.0.2 stable, you need to specify the "+23" version of lint (e.g. 30.1.0-alpha11 rather than 7.1.0-alpha11).

Seems like this may have been fixed with AGP 7.1, but calling it out in case anyone else runs into this!

tho walid

Oct 26, 2021, 10:37:22 AM10/26/21
to lint-dev
Reply all
Reply to author
0 new messages