Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

META-INF/versions/9/module-info.class: broken class file? (This feature requires ASM6)

I'm having issues with Bouncycastle, which only arise when running the :lint task.

Generally it seems to be a Java 9 byte-code version 53.0 / ASM version conflict.

These are the dependencies:

// https://mvnrepository.com/artifact/org.bouncycastle
implementation "org.bouncycastle:bcprov-jdk15on:1.64"
implementation "org.bouncycastle:bcpkix-jdk15on:1.64"

Which cause the :lint task to throw processing errors:

> Task :mobile:lint
Error processing bcpkix-jdk15on-1.64.jar:META-INF/versions/9/module-info.class: broken class file? (This feature requires ASM6)
Error processing bcprov-jdk15on-1.64.jar:META-INF/versions/9/module-info.class: broken class file? (This feature requires ASM6)

META-INF/versions/9/module-info.class: broken class file? (This feature requires ASM6)

The same goes for:

// https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation "com.google.code.gson:gson:2.8.6"

Since upgrading from 1.4.1 to 1.4.2-native-mt, it's the same again:

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2-native-mt"

kotlin-stdlib-1.4.0.jar:META-INF\versions\9\module-info.class: broken class file? (Module requires ASM6)

like image 731
Martin Zeitler Avatar asked Mar 09 '20 09:03

Martin Zeitler


1 Answers

As already mentioned this was introduced in Java 9, that Android does not support. You could just use packagingOptions to remove those classes.

android {
    packagingOptions {
        exclude "**/module-info.class"
    }
}

This should not affect actual executed code and should also remove classes for lint checks as lint is working on bytecode.

like image 196
Blaz Avatar answered Sep 20 '22 13:09

Blaz