Run a single .kt file in Android Studio
问题 I created a Scratch Kotlin file in Android Studio. I simply want to run this scratch.kt file and get output. I fiddled with Run Cofigurations but cannot understand what will go into Main Class. 回答1: If you create a top-level function called main in any kotlin file, a green run button will appear next to it that allows you to run it as a program: Note that this works in Android Studio as well as in IntelliJ IDEA. 回答2: You can create a scratch kotlin file with File -> New -> Scratch File ->