Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected failure during lint analysis of module-info.class

Tags:

android

lint

has anyone else seen this error:

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:

I only found this project facing the same problem:

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

any workaround would be nice

like image 401
ligi Avatar asked Feb 18 '19 14:02

ligi


2 Answers

The Android tooling for Android Studio 3.3 and earlier chokes on module-info.class files that are required by the 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

So, workarounds:

  • Upgrade the Android tooling to a beta of 3.4 or later. I tested 3.4.0-beta05 on one of my projects and it worked well.
  • Downgrade whatever library you're using to a version that does not yet support the JPMS (i.e. does not include a module-info.java).
like image 122
aha Avatar answered Oct 21 '22 08:10

aha


To ignore this error, I defined this in my lint.xml:

<issue id="LintError">
    <ignore regexp=".*module-info\.class.*"/>
</issue>

The above mentioned workarounds did not work for me:

  • Updating Android build tools to 3.4.1 didn't help
  • I couldn't downgrade the dependency that lead to this problem
like image 35
cdehning Avatar answered Oct 21 '22 08:10

cdehning