LightYearsBehind
LightYearsBehind

Reputation: 1804

Are "kotlin-android" and "org.jetbrains.kotlin.android" the same?

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

Answers (4)

Jade
Jade

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

Tomas
Tomas

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:

enter image description here

Source

Upvotes: 9

avalancha
avalancha

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

Yuri Schimke
Yuri Schimke

Reputation: 13498

For the kotlin gradle DSL

plugins {
    id("com.android.application") // or com.android.library
    kotlin("android")
}

https://kotlinlang.org/docs/multiplatform-mobile-understand-project-structure.html#android-application

Upvotes: 2

Related Questions