将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依赖项或其他任何内容。
main build.gradle
ext {
kotlin_version = '1.1.0'
//(...)
kotlin = "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
在app build.gradle中同步崩溃
dependencies {
compile kotlin
//...
}
答案 0 :(得分:3)
原来,“kotlin”关键字用于新版kotlin dependecy的gradle配置。解决方案是将依赖标签名从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"
}