Closed just-kip closed 6 years ago
I added kotlinx-gradle-serialization-plugin in https://github.com/JetBrains/kotlin-mpp-example and gain same error
greetings/build.gradle
// Set up a buildscript dependency on the Kotlin plugin.
buildscript {
// Specify a Kotlin version you need.
ext.kotlin_version = '1.2.60'
ext.konan_version = '0.8.2'
ext.kotlinx_serialization_version = '0.6.1'
repositories {
google()
jcenter()
maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
maven { url "https://kotlin.bintray.com/kotlinx" }
}
// Specify all the plugins used as dependencies
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$konan_version"
classpath "org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:$kotlinx_serialization_version"
}
}
// Set up compilation dependency repositories for all projects.
subprojects {
repositories {
jcenter()
google()
maven { url 'https://kotlin.bintray.com/kotlinx' }
}
}
greeting/common build.gradle
apply plugin: 'kotlin-platform-common'
apply plugin: 'kotlinx-serialization'
// Specify a group and a version of the library to access it in Android Studio.
// By default the project directory name is used as an artifact name thus the full dependency
// description will be 'org.greeting:common:1.0'
group = 'org.greeting'
version = 1.0
dependencies {
// Set up compilation dependency on common Kotlin stdlib
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-jsonparser:$kotlinx_serialization_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
}
Seems i can not use kotlinx-serialization-runtime-jsonparser in common module, is not it?
ok, i found solution in https://github.com/Kotlin/kotlinx.serialization/issues/193
The solution is:
apply plugin: 'kotlinx-serialization'
for all lib projectimplementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-jsonparser:$kotlinx_serialization_version"
implementation "org.jetbrains.kotlinx:jsonparser-native:$kotlinx_serialization_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlinx_serialization_version"
Hi, I am trying to implement api client using ktor and serialization in common plugin. I disable ios project to make sure that problem not in ios lib. gradle.wrapper
settings.gradle
My lib project build gradle
common module build.gradle
android module build.gradle
api.kt in common lib
./gradlew build
fails with following errorsI follow this guide https://github.com/Kotlin/kotlinx.serialization/blob/master/json/README.md
What is my mistake?