Generate desugared library for B4A

201 views Asked by At

I'm making an Android library for B4A framework.
Here's the situation:

  • My Android library uses Java8 features (such as Lambda)
  • B4A (Basic4Android) uses legacy dex (instead of d8) to make the apps and thus, incompatible with java8 and will not desugar by itself.

Using my aar file in the B4A results to the following error:

Uncaught translation error: com.android.dx.cf.code.SimException:
  invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
...

The solution of the official forum is to desugar the Jar of the library using Bazel's desugar tool, but it seems it leads to Expected a load for ... which is a different error and not my question.

My question:
Is it possible to generate desugared aar library (compatible with Java7 and no lambda) using Android Studio, for these cases?

I know that d8 does the desugaring, but it's output is .dex files and not .jar file.

What I've tried:
Solution said in the Android's Using Java 8 Feature did not help because it does not produce compatible jar and the error still occurs.

0

There are 0 answers