模块 -info.class 的 lint 分析期间出现意外故障

Unexpected failure during lint analysis of module-info.class

有没有其他人看到这个错误:

Errors found:

  /home/ligi/git/walleth/app/module-info.class: Error: Unexpected failure during lint analysis of module-info.class (this is a bug in lint or one of the libraries it depends on)

  Stack: NullPointerException:InvalidPackageDetector.checkClass(InvalidPackageDetector.java:112)←AsmVisitor.runClassDetectors(AsmVisitor.java:154)←LintDriver.runClassDetectors(LintDriver.kt:1461)←LintDriver.checkClasses(LintDriver.kt:1329)←LintDriver.runFileDetectors(LintDriver.kt:1096)←LintDriver.checkProject(LintDriver.kt:895)←LintDriver.analyze(LintDriver.kt:416)←LintCliClient.run(LintCliClient.java:235)

  You can set environment variable LINT_PRINT_STACKTRACE=true to dump a full stacktrace to stdout. [LintError]
  Applies to variants: noGethNoFirebaseForFDroidOnlineDebug
  /home/ligi/git/walleth/app/module-info.class: Error: Unexpected failure during lint analysis of module-info.class (this is a bug in lint or one of the libraries it depends on)

  Stack: NullPointerException:

我只发现这个项目面临同样的问题:

https://github.com/mozilla-mobile/android-components/issues/1730

任何解决方法都很好

Android Studio 3.3 和更早版本的 Android 工具阻碍了 Java Platform Module System (JPMS). Which is mind boggling considering that Java 9, the first version that shipped with the JPMS, came out in September 2017 and Java 11, the first LTS release with the JPMS, came out in September 2018, around 4 months before Android Studio 3.3. The relevant bug in the Android issue tracker: [lint] InvalidPackage crashes on module-info.class from byte-buddy

所需的 module-info.class 文件

因此,解决方法:

  • 将 Android 工具升级到 3.4 或更高版本的测试版。我在我的一个项目上测试了 3.4.0-beta05,它运行良好。
  • 将您正在使用的任何库降级为尚不支持 JPMS 的版本(即不包含 module-info.java)。

为了忽略这个错误,我在 lint.xml:

中定义了这个
<issue id="LintError">
    <ignore regexp=".*module-info\.class.*"/>
</issue>

上述解决方法对我不起作用:

  • 将 Android 构建工具更新到 3.4.1 没有帮助
  • 我无法降级导致此问题的依赖项