Android Lint 0.9.2 step issue - lintFix

I’ve been using the lint step for a while. Everything seemed to work for a while and starting failing (not sure when exactly)

I was able to take a look at what gradle command lint is calling on old builds that worked and on new builds where lint fails. It looks like there’s an extra command being passed to gradle called lintFix.

* What went wrong:
Execution failed for task ':myModule:lintFix'.
> Aborting build since sources were modified to apply quickfixes after compilation

Not sure what lintFix is, or when it was introduced, or who introduced it (is it the plugin? is it AGP?) but yeah. It’s failing due to the error above.

Any ideas?

lintFix was introduced in AGP 3.2
It applies all relevant quickfixes so source code is modified.

It seems to be a bug in Android Lint step or more precisely in go-android/task.go. Currently it treats fix as a variant: https://github.com/bitrise-tools/go-android/blob/master/gradle/task.go#L26.
However, it is incorrect since AGP 3.2. fix is reserved and cannot be used as a variant name. It already filters out lint tasks containing Vital so something similar should be applied also to fix (only if AGP 3.2+ is used).

For now there are few workarounds:

  • fix lint issues before committing, so there will be nothing to fix in build time (however, it will work only temporary, e.g. issues like obsolete dependency version will be detected again if a version of some dependency is updated)
  • specify variants explicitly in step configuration so it won’t try to figure out variants
  • disable lintFix task in buildscript: tasks.findByName('lintFix').enabled = false
1 Like

Thank you. I didn’t know lintFix was introduced in AGP. What’s the point of it? It just tries to fix everything? Very interesting approach, but most lint issues have autofixes, so it could make a lot of sense.

I think I will specify variants explicitly, or I might just wait for lint step to be updated and disable for now.

@koral I have a multi module build, and can’t figure out how to specify a few variants to be defined in the plugin. Do you have any idea?

Currently the lint step is doing this

./gradlew ":app:lintPaidBetaDebug" ":app:lintPaidBetaRelease" ":app:lintPaidProdDebug" ":app:lintPaidProdRelease" ":app:lintFreeBetaDebug" ":app:lintFreeBetaRelease" ":app:lintFreeProdDebug" ":app:lintFreeProdRelease" ":otherLib:lintDebug" ":otherLib:lintRelease" ":otherLib-no-op:lintDebug" ":otherLib-no-op:lintRelease"

For variants, would I just put :app:PaidBetaDebug, :app:FreeBetaDebug, :otherLib:Debug

I’m going to try now, but figured I would just ask anyway

I meant workflow configuration in workflow editor:

If test variant is empty, step tries to figure out all the variants and detect fix. If you set e.g. PaidBetaDebug it won’t search for variants.

1 Like

I understand. The thing is, every time I set a variant it says that it can’t find it. /shruggie

EDIT: Aha. Figured it out. The module and variant fields only take a single arg. =(

sad trombone

@koral shall we filter lint tasks That exact matches to lintFix? Like lintVital? You said only if AGP 3.2+. But I guess it can be filtered out for any version of AGP, isn’t it?

fix is reserved only since AGP 3.2+ (haven’t check from which minor version exactly). Before 3.2 you could have variant called fix. Since 3.2 gradle configuration phase will fail.

So you can filter it out always but some amount of legitimate cases will be filter out if you do that. I guess that fix is not commonly used for variant naming. So maybe it even won’t affect anyone :wink:

Just a general feature request also, it looks like you can only set a single module/variant at a time. I’d be more than happy to be able to designate multiple at once.

Scheduled a fix for this - thanks @koral for the infos! :slight_smile:

The new version is released, thank you for the info! Please let me know if you still encounter any issues with it!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.