question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AGP 7.0.0-alpha13: lint task fails

See original GitHub issue

When running the lint task with AGP 7.0.0-alpha13 it will fail with the following error:

The lint detector
timber.lint.WrongTimberUsageDetector
called context.getMainProject() during module analysis.

This does not work correctly when running in cli.

In particular, there may be false positives or false negatives because
the lint check may be using the minSdkVersion or manifest information
from the library instead of any consuming app module.

Contact the vendor of the lint issue to get it fixed/updated (if
known, listed below), and in the meantime you can try to work around
this by disabling the following issues:

"LogNotTimber","StringFormatInTimber","ThrowableNotAtBeginning","BinaryOperationInTimber","TimberArgCount","TimberArgTypes","TimberTagLength","TimberExceptionLogging"

Issue Vendors:
Identifier: timber-4.7.1

Call stack: Context.getMainProject(Context.kt:117)
←WrongTimberUsageDetector.visitMethod(WrongTimberUsageDetector.java:80)
←Detector.visitMethodCall(Detector.kt:551)
←UElementVisitor$DelegatingPsiVisitor.visitMethodCallExpression(UElementVisitor.kt:1095)
←UElementVisitor$DelegatingPsiVisitor.visitCallExpression(UElementVisitor.kt:1075)
←KotlinUFunctionCallExpression.accept(KotlinUFunctionCallExpression.kt:186)
←UQualifiedReferenceExpression$DefaultImpls.accept(UQualifiedReferenceExpression.kt:34)
←KotlinUQualifiedReferenceExpression.accept(KotlinUQualifiedReferenceExpression.kt:29)
←UQualifiedReferenceExpression$DefaultImpls.accept(UQualifiedReferenceExpression.kt:33)
←KotlinUQualifiedReferenceExpression.accept(KotlinUQualifiedReferenceExpression.kt:29)
←ImplementationUtilsKt.acceptList(implementationUtils.kt:23)
←UBlockExpression$DefaultImpls.accept(UBlockExpression.kt:21)
←KotlinUBlockExpression.accept(KotlinUBlockExpression.kt:24)
←ULambdaExpression$DefaultImpls.accept(ULambdaExpression.kt:33)
←KotlinULambdaExpression.accept(KotlinULambdaExpression.kt:29)
←ImplementationUtilsKt.acceptList(implementationUtils.kt:23)
←KotlinUFunctionCallExpression.accept(KotlinUFunctionCallExpression.kt:190)
←UQualifiedReferenceExpression$DefaultImpls.accept(UQualifiedReferenceExpression.kt:33)
←KotlinUQualifiedReferenceExpression.accept(KotlinUQualifiedReferenceExpression.kt:29)
←ImplementationUtilsKt.acceptList(implementationUtils.kt:23)

Everything works fine when using AGP 7.0.0-alpha12. Disabling the issues obviously works as a temporary workaround.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:15
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

18reactions
mohsenoidcommented, Aug 3, 2021

Any update on this issue?

7reactions
AlanChioucommented, Jul 30, 2021

I have this issue with AGP 7.0.0.

    classpath "com.android.tools.build:gradle:7.0.0"
    implementation 'com.jakewharton.timber:timber:4.7.1'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Lint failing on AGP 7.0 with "Can't initialize detector ...
It starts to fail for our root `:app` module, logs attached. The proposed workaround doesn't work. Tasks for other modules are working fine....
Read more >
gradle build fails on lint task - android - Stack Overflow
When I run the application from Android Studio, the build runs fine and executes correctly on my devices. But when I try (from...
Read more >
Known issues with Android Studio and Android Gradle Plugin
Missing lint output: There is no lint text output printed to stdout when the lint task is UP-TO-DATE (issue #191897708). Fixed in AGP...
Read more >
Speed up your app builds with the new Android Gradle plugin
Since the end of 2020, the Android Gradle Plugin (AGP) has started to ... Starting from Android Gradle plugin version 7.0, Lint tasks...
Read more >
Android User Guide - Google Samples
The Gradle plugin now maps the lint task to the default variant's lint task instead of ... As of AGP 7.0, it's possible...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found