kotlinx-atomicfu icon indicating copy to clipboard operation
kotlinx-atomicfu copied to clipboard

Add android app transformation support in the 'kotlinx-atomicfu' plugin

Open amal opened this issue 4 years ago • 4 comments

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?

amal avatar Jul 22 '20 19:07 amal

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.

enyciaa avatar Nov 05 '20 15:11 enyciaa

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

eygraber avatar Mar 08 '21 06:03 eygraber

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

SokolovaMaria avatar Mar 09 '21 13:03 SokolovaMaria

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).

mikedawson avatar Mar 25 '21 19:03 mikedawson