I've been using Kotlinx Serialization perfectly happily in my Android project.
The main project build.gradle
file has the following dependency:
dependencies {
classpath "org.jetbrains.kotlin:kotlin-serialization:${versions.project.kotlin}"
}
And in each of the modules using serialization I have:
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.plugin.serialization'
}
This works fine for Kotlin 1.6.21 but as soon as I try to upgrade to 1.7.0 I get the following convoluted message and I can't build the project.
Could not resolve org.jetbrains.kotlin:kotlin-serialization:1.7.0.
Required by:
project :config
> The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.1.3', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-serialization:1.7.0:
- apiElements
- gradle70ApiElements
- gradle70JavadocElements
- gradle70RuntimeElements
- gradle70SourcesElements
- javadocElements
- runtimeElements
- samplessources
- sourcesElements
All of them match the consumer attributes:
- Variant 'apiElements' capability org.jetbrains.kotlin:kotlin-serialization:1.7.0 declares an API of a component, preferably optimized for standard JVMs, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Unmatched attributes:
- Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '7.1.3')
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
- Provides a library but the consumer didn't ask for it
- Provides its dependencies declared externally but the consumer didn't ask for it
- Provides compatibility with Java 8 but the consumer didn't ask for it
- Provides its elements packaged as a jar but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
Has anyone else run into this problem and/or knows the solution?