在更新我的Kotlin插件后,在Android Studio中遇到了这个错误。
这是错误信息:
package com.inovate.kotlin.module3.decorations
fun main(args: Array<String>) {
makeDecorations()
}
fun makeDecorations() {
val d1 = Decorations("rectangle", 56, 20)
}
data class Decorations(val shape : String, val weight : Int, val area : Int)
这是错误信息:
* Where:
Initialization script '/private/var/folders/bn/st769wd16nv1d5_wccw8_tm00000gn/T/DecorationsKt_main__2.gradle' line: 27
* What went wrong:
A problem occurred configuring project ': app'.
> Could not create task ':app:DecorationsKt.main()'.
> SourceSet with name 'main' not found.
当我运行堆栈跟踪:
Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:DecorationsKt.main()'.
Caused by: org.gradle.api.UnknownDomainObjectException: SourceSet with name 'main' not found.
我已经更新了所有的依赖项,无效化了缓存并重新启动,尝试删除了我的.idea文件夹,但是没有成功。