-
Notifications
You must be signed in to change notification settings - Fork 665
Closed
Labels
Description
Describe the bug
It's not possible to use the library in Android projects.
Build fails, because the library requires Java 11:
> Could not resolve all files for configuration ':myproject:compileClasspath'.
> Could not resolve org.jetbrains.kotlinx:kotlinx-serialization-hocon:1.0.1.
Required by:
project :myproject
> No matching variant of org.jetbrains.kotlinx:kotlinx-serialization-hocon:1.0.1 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'apiElements' capability org.jetbrains.kotlinx:kotlinx-serialization-hocon:1.0.1 declares an API of a library, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Variant 'runtimeElements' capability org.jetbrains.kotlinx:kotlinx-serialization-hocon:1.0.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
To Reproduce
apply plugin: 'kotlin'
apply plugin: 'kotlinx-serialization'
compileKotlin {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10"
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-hocon:1.0.1'
}Expected behavior
Since com.typesafe:config is compatible with Java 8, the same should be true for org.jetbrains.kotlinx:kotlinx-serialization-hocon. The build should pass.
Environment
- Kotlin version: 1.4.10
- Library version: 1.0.1
- Kotlin platforms: JVM
- Gradle version: 6.7
- IDE version (if bug is related to the IDE): Android Studio 4.1 (but also reproducible from command line)
- Other relevant context: Mac OS X 10.15.7 x86_64, JVM 1.8.0_121 (Oracle Corporation 25.121-b13)
Dkhusainov and osipxd