CodePudding user response:
Corresponding control in your XML layout of id is what?" Button "and" editText "is the control id, you see activity_main. The XML file.CodePudding user response:
The button and the editText didn't define it, as if kotlin without the findviewbyid need to install the pluginCodePudding user response:
You didn't declare the Button and the EditTextCodePudding user response:
Do not need the findviewbyid kotlin, can be directly through the control id to access control, need a plug-in, but usually the new kotlin project automatically added, build the project. The gradle:classpath "org. Jetbrains. Kotlin: kotlin - gradle - plugin: 1.4.10"
In the module build. Gradle:
apply plugin: 'kotlin - android - extensions'
If have been added to the plugin, it should be your XML file corresponding to the id of the control is not this, or did not import, Alt + enter. Where an error is
The import kotlinx. Android. Synthetic. Main. ${XML file name}. *