Reputation: 1804
I see the following two Gradle plugins being used interchangeably in a project:
plugins {
id("kotlin-android")
}
plugins {
id("org.jetbrains.kotlin.android")
}
Are they the same?
Upvotes: 68
Views: 17204
Reputation: 707
Refer to library org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31
.
Both kotlin-android.properties
and org.jetbrains.kotlin.android.properties
link to plugin org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper
which means that they are the same.
Upvotes: 48
Reputation: 4871
Kotlin plugins can be referenced by multiple plugin IDs. The Android team recommends using the namespaced plugin ID, and refactor from shorthand to namespaced plugin ID by the following table:
Upvotes: 9
Reputation: 1775
The accepted answer does still hold true, however, I would like to point out that since Android Studio Electric Eel 2022.1.1 there is an assistant available that auto-adds Kotlin to projects. That assistant uses id 'org.jetbrains.kotlin.android'
(even if you already have kotlin-android
in the very same gradle file - quite annoyingly.
I assume somebody thought of this, maybe kotlin-android
will be deprecated in the near future? For now, the answer to your question is: they are the same but probably org.jetbrains.kotlin.android
is slightly preferred
Upvotes: 8
Reputation: 13498
For the kotlin gradle DSL
plugins {
id("com.android.application") // or com.android.library
kotlin("android")
}
Upvotes: 2