Skip to content

Support com.android.kotlin.multiplatform.library #2476

@vRallev

Description

@vRallev

The new Gradle plugin com.android.kotlin.multiplatform.library to configure Android in KMP projects isn't supported by KSP yet. This blocks the migration to the new plugin.

My project is building fine for with the current setup, e.g. I'm adding a KSP dependency like this:

dependencies {
    kspAndroid libs.kotlin.inject.ksp
}

However, when migrating to the new plugin the exact same line triggers dependency resolution errors:

Error
Could not determine the dependencies of task ':presenter-molecule:impl:kspAndroidMain'.
> Could not resolve all dependencies for configuration ':presenter-molecule:impl:androidCompileClasspath'.
   > The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of project :presenter-molecule:public:
       - Configuration ':presenter-molecule:public:androidApiElements' variant android-classes-jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-classes-jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':presenter-molecule:public:androidApiElements' variant android-lint declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':presenter-molecule:public:androidApiElements' variant android-lint-local-aar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint-local-aar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':presenter-molecule:public:androidApiElements' variant android-manifest declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-manifest' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':presenter-molecule:public:androidApiElements' variant jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
   > The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of project :kotlin-inject:public:
       - Configuration ':kotlin-inject:public:androidApiElements' variant android-classes-jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-classes-jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':kotlin-inject:public:androidApiElements' variant android-lint declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':kotlin-inject:public:androidApiElements' variant android-lint-local-aar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint-local-aar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':kotlin-inject:public:androidApiElements' variant android-manifest declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-manifest' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':kotlin-inject:public:androidApiElements' variant jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
   > The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of project :kotlin-inject-extensions:contribute:public:
       - Configuration ':kotlin-inject-extensions:contribute:public:androidApiElements' variant android-classes-jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-classes-jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':kotlin-inject-extensions:contribute:public:androidApiElements' variant android-lint declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':kotlin-inject-extensions:contribute:public:androidApiElements' variant android-lint-local-aar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint-local-aar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':kotlin-inject-extensions:contribute:public:androidApiElements' variant android-manifest declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-manifest' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':kotlin-inject-extensions:contribute:public:androidApiElements' variant jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
   > The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of project :scope:public:
       - Configuration ':scope:public:androidApiElements' variant android-classes-jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-classes-jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':scope:public:androidApiElements' variant android-lint declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':scope:public:androidApiElements' variant android-lint-local-aar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint-local-aar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':scope:public:androidApiElements' variant android-manifest declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-manifest' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':scope:public:androidApiElements' variant jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
   > The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of project :presenter:public:
       - Configuration ':presenter:public:androidApiElements' variant android-classes-jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-classes-jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':presenter:public:androidApiElements' variant android-lint declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':presenter:public:androidApiElements' variant android-lint-local-aar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-lint-local-aar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':presenter:public:androidApiElements' variant android-manifest declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'android-manifest' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it
       - Configuration ':presenter:public:androidApiElements' variant jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.10.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
           - Unmatched attributes:
               - Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
               - Provides its elements packaged as a jar but the consumer didn't ask for it

Metadata

Metadata

Assignees

No one assigned

    Labels

    GradleIssues with KSP Gradle Plugin, AGP or Gradle.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions