Android kotlin series explanation (getting started) how to run Kotlin code

<< Return to the general catalog

       Take a look at Quickstart kotlinprogramming, which doesn't involve Androiddevelopment at all. Now that it has nothing to do with it for the time being Android, the first problem to be solved is how to run a piece of kotlincode independently.

       To get started Android Studio, unfortunately, Android Studioas a tool dedicated to developing Androidapplications, only Androidprojects can be created, and kotlinprojects cannot be created. But it doesn't matter, you can open a project at will , write a function Androidin it , and you can run the codekotlinmain()kotlin independently .

       Here directly open the created HelloWorldproject, first find MainActivitythe location, as shown in the figure below - HelloWorld项目结构:

       Next MainActivitycreate a file under the sibling package structure of LearnKotlin. right click

Guess you like

Origin blog.csdn.net/qq_35091074/article/details/132480375