Run single kotlin class with main function in android studio

后端 未结 15 779
后悔当初
后悔当初 2020-12-13 13:04

I am trying to get familiar with Kotlin to use in my android apps. So first I want to try out some simple kotlin examples, just to get familiar with syntax of kotlin.

<
15条回答
  •  情深已故
    2020-12-13 13:12

    You can create a new Java library module where you can run non-Android projects, see this answer for instructions. This is a Java related question, but it should work all the same with Kotlin main functions too. Edit: I can't get this working right now.

    You could also use IntelliJ IDEA instead which is a Java/Kotlin/etc. IDE instead of an Android one, the community edition is free and supports Kotlin.

    If you just need to run really simple code, you can also do it online here: https://try.kotlinlang.org/

提交回复
热议问题