kotlinx.coroutines: Multi-version jar file problem with Android SDK
UPDATE (from @elizarov): JEP 238 multi-version jars seem to be causing various issue with google toolchain. Reported thus far:
MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)Program type already present: kotlinx.coroutines.experimental.InvokeOnCancellation,Program type already present: kotlinx.coroutines.experimental.internal.LockFreeMPMCQueueNode, etcclass name (kotlinx/coroutines/experimental/scheduling/LimitingDispatcher) does not match path (META-INF/versions/9/kotlinx/coroutines/experimental/scheduling/LimitingDispatcher.class), etc
ORIGINAL REPORT:
Trying to compile an Android project with min SDK 19 and the newly released 0.25.0 I suddenly receive the following build error:
MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
Android Studio: 3.1.4 Android Gradle Plugin: 3.1.4
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 25
- Comments: 18 (9 by maintainers)
Commits related to this issue
- AtomicFu version 0.11.4: Back to default FU variant and JS transform * Distribution no longer uses multi-version jar (unsuppored on Android) * JS version of the library does not deneds on AtomicFu: ... — committed to Kotlin/kotlinx.coroutines by elizarov 6 years ago
- AtomicFu version 0.11.4: Back to default FU variant and JS transform * Distribution no longer uses multi-version jar (unsuppored on Android) * JS version of the library does not deneds on AtomicFu: ... — committed to Kotlin/kotlinx.coroutines by elizarov 6 years ago
We’re going to revert multirelease JAR
Indeed the complete switch to multi-version JARs seems a bit premature. Especially when multiple developers are working on a project, it’s not easy to switch to alpha-level build components.
Is there a workaround for this issue without using alpha-stability components?
Not even Grade plugin
3.2is out, so I imagine that stable version for3.3will take a long time.Use
kotlinx.coroutinesversion0.25.3.In my case it was 0.25.0 coroutines. 0.24.0 – is OK.
@elizarov Would it be possible to release an artifact of the coroutines library for android without multi-version jar? Like @matejdro said I, too, hesitate to use an alpha version of the build toolchain for my production application.
Can you please tell me how to exclude these classes? I’ve tried different solutions but nothing seems to work: