Gradle is unable to locate the bintray repository for kotlinx-serialization

Viewed 751

I am trying to use kotlinx.serialization and have had just no luck. Here is the pertinent portion of the build.gradle

buildscript {
    ext.kotlin_version = '1.3.71'

    repositories {
        mavenCentral()
        google()
        jcenter()
        maven("https://kotlin.bintray.com/kotlinx")
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
    }
}

This dies on the vine:

Could not find method maven() for arguments [https://kotlin.bintray.com/kotlinx] 
on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler

enter image description here

What is an up-to-date way to incorporate kotlinx-serialization ?

2 Answers

The arguments of method maven in org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler is Closure,and the context object is type org.gradle.api.artifacts.repositories.MavenArtifactRepository,so the correct script would be like

repositories {
   mavenCentral()
   maven {
    url="https://kotlin.bintray.com/kotlinx"
  }

} what's more,kotlinx.serialization exists in mavencentral,so there is no need to add your custom maven repository

It looks like the actual version for kotlinx.serialization is 1.3.70, not 1.3.71 At least their master branch depends on 1.3.70 kotlin components

Related