Sync with Gradle fails when using custom lint checks with New Relic and Android Gradle Plugin 4.1.0

I have a project that uses custom Lint rules and New Relic (5.28.0). The app module has the following line in its dependencies block:

lintChecks project(':checks')

When I try to sync the project with Gradle, I get the following error:

A problem occurred evaluating project ':checks'.
> Failed to apply plugin [id 'kotlin']
   > Gradle#projectsEvaluated(Action) on build 'android-studio-4' cannot be executed in the current context.

The problem disappears when I remove custom lint rules or the New Relic plugin.

I reproduced the problem by forking the official Custom Lint Rules repository and adding New Relic to it:

Please, fix this so I can use custom lint checks again.

I ran this by our team for a quick look, and it sounds like linting agent code isn’t really recommended, but they are happy to take a closer look since this is causing legitimate issues.

Was this working with previous Android agent versions?

I’ll create a ticket with their team for review, and reach out if any additional information is requested.

The problem is not with linting agent code, but linting my app’s code when I have New Relic plugin applied. Basically, I can’t run my own lint rules now.
It stopped working when I upgraded to Android Gradle Plugin 4.1.0. I don’t think the issue is related to a specific New Relic plugin version.

Thanks for this additional info. I’ve shared this with our team, and will let update you once they’ve reviewed the issue in detail.

Hey @bartosz.wesolowski

I heard back from our team on this, and they’ve created a ticket for further investigating.

For now, it sounds like the best workaround is to exclude the agent plugin during lint tasks.

However, it may also be beneficial to check dependencies for conflicts and collisions: New Relic for Android compatibility and requirements

Can you try rolling back from kotlinVersion = '1.4.10' to kotlinVersion = '1.4.0' and see if that helps?

Rolling back Kotlin to version 1.4.0 doesn’t help.

@bartosz.wesolowski Sorry to hear that roll back did not help you. I’ll followup with our team to see if there is an update on the investigation into this or not to share.

Chiming in to report that my team is seeing this issue as well. @JoiConverse any updates on this?

@paul.klauser Welcome to the community :slight_smile: Our mobile team is aware of this issue and are working on a solution. There is not a timeline for when it will be resolved.