简体   繁体   中英

Override annotation required and not - Kotlin

Related to : Error: onActivityResult overrides nothing

I've tried Dhaval Patel's solution and get the report that it overrides nothing from my parser. 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

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

My IDE (Android Studio) reported a version mismatch in it's Kotlin version and the documentation. I've upgraded to 1.3.11 and it's resolved the issue by recognizing the need for the override annotation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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