Kotlin Learning Series (1)-Environment Construction

Foreword

When we learn a language, we must first look at its official website. The most authoritative and accurate
Kotlin official website.
Insert picture description here
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, Kotlinthis language IntelliJ IDEAis 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 Kotlinproject

  1. Create Project File-> New Select Kotlin | JVM | IDEA
    Insert picture description here
  2. Enter the project name and select the version number
    Insert picture description here
    Insert picture description here
  3. Create Kotlinfile

Insert picture description here
Here we call it. HelloWorld
Insert picture description here
In the mainfunction we print a sentence
Insert picture description here
and then click the triangle on the left to run
Insert picture description here

Development environment- AndroidStudio

We usually Androiduse AndroidStudioit when developing projects . It is based on it IntelliJ IDEA. From the AndroidStudio 3.0beginning, there is a built Kotlin- in plug - in, no installation is required, but it can only create Androidprojects, and we want our project support Kotlinto take only two steps

gradleAdd kotlincompilation plugin
gradleAdd kotlinstandard library dependencies

We can choose the language when creating a Kotlinproject , we first create a project directly

Insert picture description here
Here we choose Kotlin, click Finish, and wait for the compilation to complete.
Insert picture description here
Then we take a look at our gradle
first look at the entire project and then take a
Insert picture description here
look app.
Insert picture description here
We can see that the part I circled with the red box is how can I use what Kotlinneeds to be added

Published 87 original articles · Like 319 · Visit 1.49 million +

Guess you like

Origin blog.csdn.net/Greathfs/article/details/104401296