Status Update
Comments
li...@gmail.com <li...@gmail.com> #2
Oh, worth noting that rule from that sample project works fine if Lint run via console.
pr...@gmail.com <pr...@gmail.com> #3
Hi all! I face the same issue when using AS 4.2.2. I've tried on macOS and on Windows, but I can't see highlighting. I don't see highlighting neither opening the project nor after running :app:lint command (but I can see errors in the console).
dn...@google.com <dn...@google.com>
sa...@gmail.com <sa...@gmail.com> #4
mo...@gmail.com <mo...@gmail.com> #5
+1
gu...@gmail.com <gu...@gmail.com> #6
th...@acrobits.cz <th...@acrobits.cz> #7
tn...@google.com <tn...@google.com> #8
Something needs to trigger building the lint artifact, but as a workaround, here's what I did which made it work:
- Opened the sample project in Flamingo, and used the upgrade assistant to update it to 8.0.0-alpha10 (the same version of Flamingo I was using)
- Opened the test file ("Test) -- there's no lint warning yet
- Opened the terminal window inside the IDE (Help > Find Action > terminal)
- Ran "./gradlew lint"
That triggered a build, and once it finished, the IDE also updated to start showing the lint warning without me having to do anything else (see screenshot).
th...@acrobits.cz <th...@acrobits.cz> #9
However for some reason, after changing over to 8.0.0-alpha10 it started working in Flamingo Canary 10.
10...@qq.com <10...@qq.com> #10
sp...@google.com <sp...@google.com> #11
Something needs to trigger building the lint artifact
Here are 2 options that come to mind:
- Trigger building the lint.jar file during sync.
- Add a dependency from common build commands (e.g.,
assembleDebug
) to the task that creates the lint.jar file (so that at least the lint.jar file would exist more often than it does now).
Chris, do you have more context to suggest the best way forward? Both of these seem like they might cause performance regressions, and I'm not sure that option 1 is even allowed.
cm...@google.com <cm...@google.com> #12
Yes, I agree we need a way to do this, but also that those options both have downsides as Scott identifies.
I wonder if we need to have a 'build custom lint checks' action in the IDE, maybe with some level of prompting to trigger it in Studio if we detect that the user has configured their project to have custom lint rules but they're not built yet.
tn...@google.com <tn...@google.com> #13
What if we had a lint{} block option which basically says to aggressively build local lint checks? And then I realized that maybe the presence of lintChecks
in the dependencies block is that option?
te...@gmail.com <te...@gmail.com> #14
br...@onepeloton.com <br...@onepeloton.com> #15
al...@google.com <al...@google.com> #16
Checking in after a year with no movement. We're still missing custom lint check highlighting in AndroidX, which is causing issues to only show up in presubmit e.g. at the end of the development cycle rather than a more appropriate time in the IDE. I agree with
al...@google.com <al...@google.com> #17
At a minimum, if this is going to stay P3
then please provide a reliable, recommended workaround that we can implement in the build.
tn...@google.com <tn...@google.com> #18
I'm not a Gradle expert but the trick is to make sure that the lint check jars are actually built -- that doesn't happen when you just sync your project. So a build time workaround is to actually run lint before you open the project. There are probably Gradle targets that do less than that; Scott or Chris would know.
lp...@google.com <lp...@google.com> #19
So a build time workaround is to actually run lint before you open the project.
To clarify, studio has no way of picking up lint jars that are built since studio was opened / the project was opened? So we would need to run this as a prerequisite to opening the studio project, and require restarting studio if new lint checks have been added since studio was launched?
tn...@google.com <tn...@google.com> #20
Uhm it does do up to date checks each time it runs (
cm...@google.com <cm...@google.com> #21
Just running assemble on the projects that define the custom lint checks is enough, and as Tor says they are picked up almost immediately.
So for androidx I guess you could have studiow do that building if you wanted to ensure the checks were built when opening studio, and downloading/starting Studio could happen in parallel to that building.
cm...@google.com <cm...@google.com> #22
And yes, maybe the right answer here is to have studio at have the option to automatically trigger or prompt to trigger the building of custom lint checks if they are not built after the project is imported. Annoyingly we don't have all the information we'd need to do that correctly from the models we pass to the IDE now, and I'm wary of heuristics for things like this, but there's no technical blocker to adding the information needed.
tn...@google.com <tn...@google.com> #23
I think we're adding an option right now to let people skip sync, right? Maybe we can add an option for this too. I understand that basing it on something like the presence of lintConfig or lintPublish is tricky (not available yet when needed) but maybe a gradle.properties? (We can even warn in the IDE if we see local lint checks and the flag hasn't been set to encourage usage.)
sp...@google.com <sp...@google.com> #24
cc Karima who was looking into this recently.
lp...@google.com <lp...@google.com> #25
I ran lint locally (Compose studio project) and it seemed to cause studio to quickly pick up the lint jars, and start warning in IDE as well, so confirming that this workaround seems to work at least.
ka...@google.com <ka...@google.com>
10...@gmail.com <10...@gmail.com> #26
small project work ok, but big project not show warning. and no show in Inspections.
pa...@google.com <pa...@google.com> #27
I recently submitted a change:
that should improve how Android Studio discovers/registers third party lint checks (from jars). It does not change anything on the Gradle/sync side, and I am not completely sure how it relates to checks that are provided as source, and need to be built. But it may help. It should be available in Meerkat Feature Drop Canary 8.
Description
Hi I used AS 4.1.1 (AFAIR). Clonedhttps://github.com/googlesamples/android-custom-lint-rules and observed the custom lint rule highlighting working in AS. Then I updated AS to 4.2.2. After that the highlighting has stopped working.
Few keynotes:
What can be the reason of that? How can I make highlighting work again?