使用 kotlin 版本“1.4.32”运行我的 Android 项目运行和构建。尝试升级到 kotlin '1.5.0' 并且我的构建抛出:
Execution failed for task ':app:kaptDefaultsDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
Run Code Online (Sandbox Code Playgroud)
我什至不知道从哪里开始寻找。还有其他人在升级到 kotlin 1.5.0 时遇到问题吗?
我有两个班Entity
,并Account
为
abstract class Entity(
var id: String? = null,
var created: Date? = Date()) {
constructor(entity: Entity?) : this() {
fromEntity(entity)
}
fun fromEntity(entity: Entity?): Entity {
id = entity?.id
created = entity?.created
return this;
}
}
Run Code Online (Sandbox Code Playgroud)
和
data class Account(
var name: String? = null,
var accountFlags: Int? = null
) : Entity() {
constructor(entity: Entity) : this() {
super(entity)
}
}
Run Code Online (Sandbox Code Playgroud)
这给了我错误
超级不是表达式,它只能用在点'左'的左侧.
为什么我不能这样做?
以下将传递编译错误,但我不确定它是否正确.
constructor(entity: Entity) : this() {
super.fromEntity(entity)
}
Run Code Online (Sandbox Code Playgroud)