uber / AutoDispose

Automatic binding+disposal of RxJava streams.

Home Page:https://uber.github.io/AutoDispose/

Repository from Github https://github.comuber/AutoDisposeRepository from Github https://github.comuber/AutoDispose

gradle 7.1 and AGP 7.0.0-beta05

markchristopherng opened this issue · comments

Library version: 2.0.0

Repro steps or stacktrace:
When running lintDebug with the new AGP 7.0.0-beta05 & gradle 7.1 I get the following lint error;

Error: The lint detector
autodispose2.lint.AutoDisposeDetector
called context.getMainProject() during module analysis.

This does not work correctly when running in AGP (7.0.0-beta05).

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:

"AutoDispose"

Issue Vendors:
Identifier: jetified-autodispose-android-2.0.0

Call stack: Context.getMainProject(Context.kt:117)←AutoDisposeDetector.beforeCheckRootProject(AutoDisposeDetector.kt:117)←LintDriver.checkProject(LintDriver.kt:1127)←LintDriver.checkProjectRoot(LintDriver.kt:609)←LintDriver.access$checkProjectRoot(LintDriver.kt:152)←LintDriver$analyzeOnly$1.invoke(LintDriver.kt:440)←LintDriver$analyzeOnly$1.invoke(LintDriver.kt:434)←LintDriver.doAnalyze(LintDriver.kt:498)←LintDriver.analyzeOnly(LintDriver.kt:433)←LintCliClient$analyzeOnly$1.invoke(LintCliClient.kt:245)←LintCliClient$analyzeOnly$1.invoke(LintCliClient.kt:245)←LintCliClient.run(LintCliClient.kt:287)←LintCliClient.run$default(LintCliClient.kt:270)←LintCliClient.analyzeOnly(LintCliClient.kt:245)←Main.run(Main.java:1536)←Main.run(Main.java:269)←NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)←NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)←DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)←Method.invoke(Method.java:566) [LintError]

Lint found errors in the project; aborting build.

Duplicate of #445. Please search the issue tracker before posting new ones.

Unfortunately, version 1.4 of the library has never been fixed.
The fix is in version 2.0 of the library, but it works with RxJava 3

For those who faced the problem and use the library version 1.4 and RxJava 2, you can simply disable the Lint rule and the error will disappear

build.gradle file:

android {
    ...

    lint {
        disable 'AutoDispose'
    }
}