Search code examples
androidgradlekotlingradle-kotlin-dslkotlin-dsl

How to migrate from Kotlin 1.2 to 1.3 with the kotlin-dsl Gradle plugin?


I am currently using the kotlin-dsl Gradle plugin 0.18.2, Kotlin 1.2.51 and Gradle 4.10.2 in my Android project (take a look at the temporary project-setup branch).
I like to migrate to Kotlin 1.3. However, I have difficulties in finding out which combination of version works. I raised the dependencies to their latest version:

// in build.gradle.kts:
id("org.gradle.kotlin.kotlin-dsl") version "1.0.4"  

...

// in build.gradle:
org.jetbrains.kotlin:kotlin-stdlib:1.3.10 

As soon as I run a Gradle task it fails with the following error:

WARNING: Unsupported Kotlin plugin version. The embedded-kotlin and kotlin-dsl plugins rely on features of Kotlin 1.2.61 that might work differently than in the requested version 1.3.10.

Is there a migration guide besides what is written in the release notes of the kotlin-dsl Gradle plugin?

Related


Solution

  • The source of the migration problems was a misconfiguration of the buildSrc folder. I was treating it as a module in the settings.gradle file:

    include ':app', ':buildSrc', ':database', ':network'

    Instead it should be treated as an included build as stated in the Gradle documentation.
    The solution given by Paul Merlin, @eskatos was to simply remove the buildSrc folder there:

    include ':app', ':database', ':network'