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.
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
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 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
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.