android - Getting "Conflicting overloads" for every function in one Kotlin file whenever I change it
问题描述
For one Kotlin file in my project, almost every time I make changes to it and rebuild, I get "Conflicting overload" messages for every function. There aren't two conflicting functions; each error message lists exactly the same function twice. If I do a clean build, it builds fine.
e: ContentApi.kt: (220, 1): Conflicting overloads: public fun loadExclusions(assetIds: List): Unit defined in com.foo.bar in file ContentApi.kt, public fun loadExclusions(assetIds: List): Unit defined in com.foo.bar in file ContentApi.kt
Changes to other Kotlin files don't produce the same problem. I can create a function in another Kotlin file, build with no trouble, then cut and paste it into this file, and boom.
Has anyone else seen something like this? My best guess is that it's some kind of bug with the compiled code cache where the newly compiled code doesn't replace the previous version, so they conflict with each other.
Android Studio/Gradle version 3.2 RC 3 Kotlin version 1.2.61
解决方案
当您有两个名称相同但注释不同的函数时,通常会发生这种情况。
例如:
@PrePersist
public fun loadExclusions(assetIds: List){
}
@PreUpdate
public fun loadExclusions(assetIds: List){
}
推荐阅读
- javascript - 如何限制从组合框 Extjs 中选择值
- apache-spark - shc-core: NoSuchMethodError org.apache.hadoop.hbase.client.Put.addColumn
- javascript - 根据内容文本更改背景颜色
- python - Python 3.5 .format() 方法
- javascript - 循环三位数字,其中 product == sum
- android - 带有材质组件的 MapView
- android - 从 Firebase 中的 MainActivity 上传 RecyclerView 的所有数据
- java - 使用 firebaseAuth 创建用户。但是,一旦注册成功,其他设备设备也会受到影响
- azure - OpenTypes 不支持打开导航属性。属性名称:'DirectoryDataService.changePassword'
- javascript - 输入元素将类型切换为隐藏时的奇怪行为