简体   繁体   English

覆盖所需的注释而不是 - Kotlin

[英]Override annotation required and not - Kotlin

Related to : Error: onActivityResult overrides nothing 相关: 错误:onActivityResult不会覆盖任何内容

I've tried Dhaval Patel's solution and get the report that it overrides nothing from my parser. 我已经尝试过Dhaval Patel的解决方案并获得报告,它不会覆盖我的解析器。 Omitting the override annotation reports that it hides the super method and override is required. 省略覆盖注释会报告它隐藏了超级方法并且需要覆盖。 Is there an issue with my parser? 我的解析器有问题吗?

How the documentation says to implement the method (which won't compile) https://developer.android.com/training/basics/intents/result 文档如何实现该方法(不会编译) https://developer.android.com/training/basics/intents/result

How I only get a parser warning - overrides nothing, override redundant 我如何只获得解析器警告 - 覆盖任何内容,覆盖冗余

override fun onActivityResult(requestCode:Int, resultCode:Int, data:Intent?) 

How I get a compile error - override annotation required: 如何获得编译错误 - 覆盖所需的注释:

fun onActivityResult(requestCode:Int, resultCode:Int, data:Intent?)

Thanks to a clue from byxor, I checked my build.grade 感谢byxor提供的线索,我查看了build.grade

My IDE (Android Studio) reported a version mismatch in it's Kotlin version and the documentation. 我的IDE(Android Studio)报告了它的Kotlin版本和文档中的版本不匹配。 I've upgraded to 1.3.11 and it's resolved the issue by recognizing the need for the override annotation. 我已升级到1.3.11,它通过识别覆盖注释的需要解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM