Repository: JakeWharton/timber

Issue #408: AGP 7.0.0-alpha13: lint task fails
Created: 2021-04-07T11:24:23Z
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.

Duplicate issue #409: Lint Failure in CLI
Created: 2021-04-19T14:49:16Z
Description
I am currently seeing an error in the Lint Report of my build pipeline. A quick check did not reveal anything similar here in the issues, and Google also does not seem to have anything on this yet. I know that I am working on the bleeding edge of tool versions (check versions below), so I expect some hickups.
I am not sure whether this can even be fixed through Timber, my suspicions are more towards the new Android Gradle Plugin, but we'll see. Here is an abbreviated version of the error message, for readability please find the full message here
../../src/main/java/.../Helper.java: The lint detector
timber.lint.WrongTimberUsageDetector
called context.getMainProject() during module analysis.
[...]
Contact the vendor of the lint issue to get it fixed/updated 
[...]
Issue Vendors:
Identifier: jetified-timber-4.7.1

Call stack: Context.getMainProject(Context.kt:117)
←WrongTimberUsageDetector.visitMethod(WrongTimberUsageDetector.java:80)
[...]

How to reproduce

Add Timber and Android Gradle Build Tools 7.0 to project
Add Timber.tag("myTag").d("FooBar"); to any class
full build on CLI via gradle assembleRelease

I am still working on checking which things to roll back for the message to go away. More details to follow here if I find them
Versions
Timber: 4.7.1
Android Tools Build Gradle: 7.0.0-alpha14
Gradle: 7.0
CompileSdk: 30
TargetSdk: 30
Java Version (source_compatibility): 1.8

Closing comment (2021-04-19T20:53:02Z): Seems the same as #408