Select your module in the Project window, and then select File > New, select any Android template, and then choose Kotlin as the Source language.
Gradle is a build system that is very commonly used in the Java, Android, and other ecosystems. It is the default choice for Kotlin/Native and Multiplatform when it comes to build systems.
Kotlin 1.6 was released in November 2021. Kotlin 1.7 was released in June 2022, including the alpha version of the new Kotlin K2 compiler.
You can check the Kotlin version in Tools | Kotlin | Configure Kotlin Plugin Updates. If you have projects created with earlier Kotlin versions, change the Kotlin version in your projects and update kotlinx libraries if necessary – check the recommended versions.
I followed Miha_x64's advice and upgraded the plugin which solved my problem:
Tools
->Kotlin
->Configure Kotlin Plugin Updates
->Check for updates now
My version of Android Studio is:
Android Studio 3.0.1
Build #AI-171.4443003, built on November 9, 2017
In my case, I converted Java to Kotlin and I have already Kotlin installed with lower version. So I updated it.
Tools
-> Kotlin
-> Configure Kotlin Plugin Updates
then Check for updates now
then choose Stable
.
But it didn't update my version in the build.gradle
file automatically. Because it detected a newer version and differs from the old one.
So I manually updated my version to the latest from
ext.kotlin_version = '1.0.0'
to ext.kotlin_version = '1.2.41'
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
There's an issue in Android Studio 3.0 Canary 4 that prevents it from loading the updated version of the Kotlin plugin. You can ignore the warning shown by the Kotlin plugin in build.gradle until a newer version of Android Studio 3.0 is released.
I also had the same issue, I am using Android Studio 3.2.1
Change the Kotlin version of your project build.gradle file(not module build.gradle file) to latest(at the moment it is 1.3.11)
ext.kotlin_version = '1.3.11'
then there will be notification call Kotlin migration, click Run migrations link on the notification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With