title: How to add a dependency to build.gradle.kts for kotlin-multiplatform (kotlin 1.3.50)?
body: <p>I started a new project with kotlin-multiplatform to create a library usable on iOS and Android using this tutorial :</p>
  
  <p><a href="https://play.kotlinlang.org/hands-on/Targeting%20iOS%20and%20Android%20with%20Kotlin%20Multiplatform/01_Introduction" rel="nofollow noreferrer">https://play.kotlinlang.org/hands-on/Targeting%20iOS%20and%20Android%20with%20Kotlin%20Multiplatform/01_Introduction</a></p>
  
  <p>It seems to work fine but I wanted to add the Serialization library mentioned at the end of the tutorial (<a href="https://github.com/Kotlin/kotlinx.serialization" rel="nofollow noreferrer">https://github.com/Kotlin/kotlinx.serialization</a>) and I can't make it work.</p>
  
  <p>The setup guide in the library is not in Kotlin DSL so I tried different things to adapt the code but without success. Here is my project gradle :</p>
  
  <pre><code>buildscript {
      ext.kotlin_version = '1.3.50'
      repositories {
          google()
          jcenter()
          maven { url "https://kotlin.bintray.com/kotlinx" }
      }
  
      dependencies {
          classpath 'com.android.tools.build:gradle:3.5.1'
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
          classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
          mavenCentral()
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  
  <p>And now my build.gradle.kts</p>
  
  <pre><code>import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
  
  plugins {
      kotlin("multiplatform")
      kotlin("plugin.serialization")
  }
  
  
  kotlin {
      //select iOS target platform depending on the Xcode environment variables
      val iOSTarget: (String, KotlinNativeTarget.() -&gt; Unit) -&gt; KotlinNativeTarget =
          if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
              ::iosArm64
          else
              ::iosX64
  
      iOSTarget("ios") {
          binaries {
              framework {
                  baseName = "SharedCode"
              }
          }
      }
  
      jvm("android")
  
      sourceSets["commonMain"].dependencies {
          implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
          implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:0.13.0")
  
      }
  
      sourceSets["androidMain"].dependencies {
          implementation("org.jetbrains.kotlin:kotlin-stdlib")
          implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.13.0")
      }
  
      sourceSets["iosMain"].dependencies {
          implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:0.13.0")
      }
  }
  
  val packForXcode by tasks.creating(Sync::class) {
      val targetDir = File(buildDir, "xcode-frameworks")
  
      /// selecting the right configuration for the iOS
      /// framework depending on the environment
      /// variables set by Xcode build
      val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
      val framework = kotlin.targets
          .getByName&lt;KotlinNativeTarget&gt;("ios")
          .binaries.getFramework(mode)
      inputs.property("mode", mode)
      dependsOn(framework.linkTask)
  
      from({ framework.outputDirectory })
      into(targetDir)
  
      /// generate a helpful ./gradlew wrapper with embedded Java path
      doLast {
          val gradlew = File(targetDir, "gradlew")
          gradlew.writeText("#!/bin/bash\n"
                  + "export 'JAVA_HOME=${System.getProperty("java.home")}'\n"
                  + "cd '${rootProject.rootDir}'\n"
                  + "./gradlew \$@\n")
          gradlew.setExecutable(true)
      }
  }
  
  tasks.getByName("build").dependsOn(packForXcode)
  </code></pre>
  
  <p>I have no errors but I cannot use the library in my code.
  Can someone please explain how to integrate this dependency or any dependency with this setup ? What do I do wrong ?</p>
  
  <p>Note : I'm using Android Studio 3.5.1, Gradle 5.4.1, Kotlin 1.3.50.</p>