Kotlin崩溃无法将提供的符号转换为Dependency类型的对象:org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension_Decorated
在将kotlin版本从1.0.5-2撞到1.1.0之后,我得到一个崩溃:
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.
该项目没有同步,所以我不能调用gradle依赖或其他任何东西。
主build.gradle
ext { kotlin_version = '1.1.0' //(...) kotlin = "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" }
同步崩溃在应用程序build.gradle
dependencies { compile kotlin //... }
原来,kotlin依赖关系的新版本的gradle配置中使用了“kotlin”关键字。 解决方案是将依赖标签名称从kotlin更改为(例如)kotlinDependency
旧:
ext { kotlin_version = '1.1.0' //(...) kotlin = "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" }
新:
ext { kotlin_version = '1.1.0' //(...) kotlinDependency = "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" }