Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
amal opened this issue Jul 22, 2020 · 4 comments
Open
Assignees

Comments

@amal
Copy link

amal commented Jul 22, 2020

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 amal changed the title Add android support in the 'kotlinx-atomicfu' plugin Add android app transformation support in the 'kotlinx-atomicfu' plugin Jul 22, 2020
@enyciaa
Copy link

enyciaa commented Nov 5, 2020

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.

@eygraber
Copy link

eygraber commented Mar 8, 2021

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

@SokolovaMaria SokolovaMaria pinned this issue Mar 9, 2021
@SokolovaMaria SokolovaMaria unpinned this issue Mar 9, 2021
@SokolovaMaria
Copy link
Contributor

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 SokolovaMaria self-assigned this Mar 9, 2021
@mikedawson
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants