自“androidx-livedata”更新 2.3.0 以来,lint 分析期间出现意外失败

P K*_*ers 5 android lint mutablelivedata androidx

运行 lint 时发生了一个奇怪的错误。这似乎发生在androidx.lifecycle从 2.2.0 更新到 2.3.0

\n
../../src/main/java/my/project/MyService.kt: Unexpected failure during lint analysis of MyService.kt\n(this is a bug in lint or one of the libraries it depends on)\n\nMessage: org.jetbrains.uast.UastErrorType cannot be cast to com.intellij.psi.PsiClassType\n\nThe crash seems to involve the detector androidx.lifecycle.lint.NonNullableMutableLiveDataDetector.\nYou can try disabling it with something like this:\n    android {\n        lintOptions {\n            disable "NullSafeMutableLiveData"\n        }\n    }\n\nStack: ClassCastException:NonNullableMutableLiveDataDetector.visitMethodCall(NonNullableMutableLiveDataDetector.kt:103)\n\xe2\x86\x90UElementVisitor$DelegatingPsiVisitor.visitMethodCallExpression(UElementVisitor.kt:1079)\n\xe2\x86\x90UElementVisitor$DelegatingPsiVisitor.visitCallExpression(UElementVisitor.kt:1059)\n\xe2\x86\x90UCallExpression$DefaultImpls.accept(UCallExpression.kt:85)\n\xe2\x86\x90UCallExpressionEx$DefaultImpls.accept(UCallExpression.kt:-1)\n\xe2\x86\x90KotlinUSimpleReferenceExpression$KotlinAccessorCallExpression.accept(KotlinUSimpleReferenceExpression.kt:129)\n\xe2\x86\x90KotlinUSimpleReferenceExpression.visitAccessorCalls(KotlinUSimpleReferenceExpression.kt:116)\n\xe2\x86\x90KotlinUSimpleReferenceExpression.accept(KotlinUSimpleReferenceExpression.kt:83)\n\nYou can set environment variable LINT_PRINT_STACKTRACE=true to dump a full stacktrace to stdout.\nThis issue type represents a problem running lint itself. Examples include failure to find bytecode for source files (which means certain detectors could not be run), parsing errors in lint configuration files, etc.\n\nThese errors are not errors in your own code, but they are shown to make it clear that some checks were not completed.\nTo suppress this error, use the issue id "LintError" as explained in the Suppressing Warnings and Errors section.\n
Run Code Online (Sandbox Code Playgroud)\n

当我NullSafeMutableLiveData按照建议禁用时,错误不再发生,太棒了!但我想知道这个问题从何而来,是否有比完全忽略该特定检查更好的解决方案。这是一个错误吗androidx.lifecycle,还是可能以某种方式与我可以修复的项目中的错误发生冲突?(如果是这样,有什么建议可以找出在哪里吗?)

\n

注意:这只发生在 Bitrise 上运行 lint 时,我在 Android Studio 中运行 lint 时没有遇到这种情况。但不确定这是否有某种关系。

\n