Get started with Kotlin for Android Development

Get started with Kotlin for Android Development

Firstly we learn about history of Kotlin language.

Kotlin is open source, statically-typed and object oriented programming language that runs on Java Virtual Machine (JVM). It is developed by JetBrains, a software development company that has developed a popular IDE IntelliJ. In July 2011 JetBrains revealed about Project Kotlin. The first version of Kotlin was released in February 2016 i.e. Kotlin v1.0. Kotlin is a JVM language ,it means it needs JVM to execute its bytecode.

kotlin vs java.png

Because of these features most of the Android developers prefer Kotlin over java.

  • Statically Typed Language
  • Support to avoid NullPointerException.
  • Supports immutability.
  • Object oriented language.
  • 100% Interoperable with java
  • Concise ,Safe and powerful.
  • Open Source

In 2017, Google announced Kotlin as one of the official languages for Android Development and sponsored it.

TYPES OF APPS THAT YOU CAN BE BUILD USING KOTLIN

  1. Server-side Apps [string Boot, vert.x , JSF, Ktor]
  2. Android Development
  3. Web Development [ Kotlin / JS ]
  4. Desktop Application [ JavaFX,TornadoFX ]
  5. Native Development [ Kotlin / Native Library ]

Installation of Kotlin

Just like installing Java or python, Kotlin is quite similar! Head over to the Kotlin Official Github page and download the command line version since we shall be using that in this tutorial.

🔼 Install JDK

🔼 Run & Install the JDK (Admin rights required)

🔼 Open this Kotlin Github release page

🔼 Scroll down to the assets section, download the latest version of the compiler.

🔼 You can grab kotlinc

🔼 Unzip the file in a folder from where we have access to write.

🔼 Recommended creating a new Kotlin folder in the root user folder.

🔼 Update the PATH variable with the bin location of Kotlin’s compiler. For example D:\kotlinc\bin

Let me know in the comment section if you need more help in updating the path variable otherwise, you can stack overflow, google and any tutorial.

Hurrey now it's time to write our first program in kotlin

hurrey .jpg

Kotlin Hello world program

fun main()
{
    println("HELLO,WORLD!!!!")
}
Output:
HELLO,WORLD!!!!

EXPLANATION

EXPLAINATION.png

If you have read up to this point,Kudos to you. In the next article,we will look at Variables and Data types. Hope you enjoyed the article.

Let's connect me on Linkedin