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

transformAndroidMainAtomicfu task failed for KMP library (Android/JVM/iOS) #511

Open
GazimSoliev opened this issue Feb 11, 2025 · 3 comments
Labels

Comments

@GazimSoliev
Copy link

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':kmplib:transformAndroidMainAtomicfu'.

Task with path 'androidMainClasses' not found in project ':kmplib'.

Gradle configuration of module:

@file:Suppress("UnstableApiUsage")

import com.android.build.api.dsl.androidLibrary

plugins {
    alias(libs.plugins.kotlin.multiplatform)
    alias(libs.plugins.android.multiplatform.library)
    alias(libs.plugins.kotlin.atomic)
}

kotlin {
    iosX64()
    iosArm64()
    iosSimulatorArm64()

    jvm()
    jvmToolchain(8)

    androidLibrary {
        namespace = "org.example"
        compileSdk = 35
    }
}
@fzhinkin
Copy link
Contributor

The atomicfu plugin does not support the Android plugin (#90, #145), thus the error.

@GazimSoliev
Copy link
Author

The atomicfu plugin does not support the Android plugin (#90, #145), thus the error.

Then may this plugin be as a library to add this for all source sets?

@fzhinkin
Copy link
Contributor

You can use the atomicfu as a library, w/o the plugin (there will be no transformations applied to sources, though, so all atomic types will be boxed types in runtime). Just add a dependency on org.jetbrains.kotlinx:atomicfu library.

If it is fine to use boxes atomic types for your particular use case, it might be worth migrating to common atomic types that will be shipped with the Kotlin standard library starting from 2.1.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants