Foreword
When we learn a language, we must first look at its official website. The most authoritative and accurate
Kotlin official website.
We slide to the bottom and find that there are 4 IDE integration methods. The first two we use are the first two.
Development environment- IntelliJ IDEA
First of all, Kotlin
this language IntelliJ IDEA
is produced by a company, so it has a built Kotlin
- in plug - in, no installation is required, and a new version will only need to be updated in the future, so that we can directly create a Kotlin
project
- Create Project File-> New Select Kotlin | JVM | IDEA
- Enter the project name and select the version number
- Create
Kotlin
file
Here we call it. HelloWorld
In the main
function we print a sentence
and then click the triangle on the left to run
Development environment- AndroidStudio
We usually Android
use AndroidStudio
it when developing projects . It is based on it IntelliJ IDEA
. From the AndroidStudio 3.0
beginning, there is a built Kotlin
- in plug - in, no installation is required, but it can only create Android
projects, and we want our project support Kotlin
to take only two steps
gradle
Addkotlin
compilation plugin
gradle
Addkotlin
standard library dependencies
We can choose the language when creating a Kotlin
project , we first create a project directly
Here we choose Kotlin
, click Finish, and wait for the compilation to complete.
Then we take a look at our gradle
first look at the entire project and then take a
look app
.
We can see that the part I circled with the red box is how can I use what Kotlin
needs to be added