kotlinx-atomicfu
kotlinx-atomicfu copied to clipboard
Add android app transformation support in the 'kotlinx-atomicfu' plugin
Seems that using 'kotlinx-atomicfu' plugin in the Android app is not supported:
- no
:transformAtomicfuClasses
task in build -
NoClassDefFoundError: Failed resolution of: Lkotlinx/atomicfu/AtomicFU
in runtime
May I'm doing something wrong?
I'm also getting this error when running a KMM app. The iOS side runs fine, just android throws java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/atomicfu/AtomicFU;
when starting a class with an atomic.
Getting this when running a MPP project that has common and jvm code.
There's a module (:core
) that uses the atomicfu
plugin and has atomicfu
code in common source.
There's another module that is a desktop jvm app, which depends on :core
and when I run it I get:
Exception in thread "main" java.lang.NoClassDefFoundError: kotlinx/atomicfu/AtomicFU
I'm working on thekotlin-android
plugin support now. This task was postponed for some time, as it was not the highest priority. The related issue: #90
Hi,
I also had the NoClassDefFoundError on my Android app. I managed to avoid it by manually adding the dependency to the commonMain of my multiplatform module:
implementation "org.jetbrains.kotlinx:atomicfu:$version_atomicfu"
I think allowing the code to compile on Android only to crash immediately on use is a fairly major issue. Can the README get updated to include the status of Android support (which is a key target for Kotlin multiplatform development)? Also the README recommends using:
compile "org.jetbrains.kotlinx:atomicfu-common:$atomicfu_version"
I think the use of compile has been deprecated in Gradle for a long time (e.g. should be changed to implementation). Also since Kotlin1.4 the "-common" postfix is not used (and hence the dependency does not resolve unless the -common postfix is removed).