preface

  • Kotlin is officially recognized by Google as a level 1 programming language for Android development
  • Today, I will present a comprehensive and detailed introduction to Kotlin, including defining features, configuring usage, and getting started syntax. I hope you will enjoy it.


directory


Definition 1.

  • Level 1 Programming language developed for Android (Google official certification)
  • Launched in 2010 by JetBrains & open source, interworking with the Java language & with a number of new features not yet supported by Java
  • Versions of Android Studio3.0 and later support Kotlin

Characteristics of 2.


3. Configure and use

Here’s how to configure Kotlin for use in Android Studio.

3.1 Android Studio3.0 pre-release

It consists of three steps to complete the Kotlin configuration.

Step 1: Install the Kotlin plug-in

Click on Android Studio Preference -> Plugins -> to search for the Kotlin Languages plugin

Step 2: Add it to build.gradle in the root directory

buildscript {
    ext.kotlin_version = '1.2.10'

    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"}}Copy the code

Step 3: Import in app/build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

buildscript {
    ext.kotlin_version = '1.2.10'

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"}}Copy the code

3.2 Android Studio3.0 version before and after

Android Studio Preference -> Plugins -> Search for Kotlin Languages


4. Basic grammar

In this section, we will explain Kotlin’s basic syntax in detail, including:

  • Basic concepts (vs. Java)
  • The data type
  • class
  • Variables & constants
  • function
  • Other syntactic sugar (control flow, type checking & conversion, security, etc.)

See article for details:

  • Android: A comprehensive & detailed introduction to Kotlin syntax guide (Classes, variables & Functions)

  • Kotlin: That’s all the introductory syntax for using classes!

That concludes the introductory syntax for Kotlin.


5. To summarize

  • This article provides a comprehensive introduction to Kotlin learning, including defining features, configuring usage, and getting started with syntax
  • In the upcoming articles, I will continue to explain Kotlin, including its usage and syntax. If you are interested, please follow me on my blog: Carson_ho’s Android blog

Please give the top/comment a thumbs up! Because your approval/encouragement is my biggest motivation to write!