Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin crash Cannot convert the provided notation to an object of type Dependency: org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension_Decorated

After bumping version of kotlin from 1.0.5-2 to 1.1.0 I get a crash:

Error:(114, 0) Cannot convert the provided notation to an object of type Dependency: org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension_Decorated@5a39a165.
The following types/formats are supported:
  - Instances of Dependency.
  - String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
  - Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
  - FileCollections, for example files('some.jar', 'someOther.jar').
  - Projects, for example project(':some:project:path').
  - ClassPathNotation, for example gradleApi().

Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.

The project is not synced so I cannot call gradle dependencies or anything else.

main build.gradle

ext {
    kotlin_version = '1.1.0'
    //(...)
    kotlin = "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

Sync crashes in app build.gradle

dependencies {
    compile kotlin
    //...
}
like image 934
RaINqer Avatar asked Oct 15 '25 02:10

RaINqer


1 Answers

Turns out that "kotlin" keyword is used within gradle configuration of the new version of kotlin dependecy. The solution was to change the dependency labelname from kotlin to (for example) kotlinDependency

Old:

ext {
    kotlin_version = '1.1.0'
    //(...)
    kotlin = "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

New:

ext {
    kotlin_version = '1.1.0'
    //(...)
    kotlinDependency = "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
like image 165
RaINqer Avatar answered Oct 19 '25 21:10

RaINqer