将 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"
}
app 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"
}
关于android - Kotlin 崩溃无法将提供的符号转换为 Dependency 类型的对象 : org. jetbrains.kotlin.gradle.dsl.KotlinProjectExtension_Decorated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42701258/