2

Whats the difference between plugin "kotlin" and "kotlin-android"? Could not find a docu about it. The official Kotlin Documentation only talks about apply plugin: 'kotlin' But if you create a new module in Android Studio you currently get apply plugin: 'kotlin-android' and there seems to be a behavior difference. If for example I have a build.gradle file with apply plugin: 'java-library' I cannot use apply plugin: 'kotlin-android', you get an error with a list of allowed plugins. If the build.gradle file has instead of apply plugin: 'java-library' apply plugin: 'android-library' then you can also set apply plugin: 'kotlin-android' or apply plugin: 'kotlin', but in combination with other stuff in the gradle file you will get compilation errors or not depending on the case, so I'm not sure what's the offcial difference.

MC Emperor
  • 22,334
  • 15
  • 80
  • 130
David
  • 3,971
  • 1
  • 26
  • 65

1 Answers1

1

I haven't tried the specific configuration that you mention, but generally speaking:

'kotlin': Kotlin plugin for projects that are not necessarily targeted for the Android platform. Configurations to compile Kotlin and generate byte code but nothing Android specific.

'kotlin-android plugin': on the other hand, extends the functionality of the kotlin plugin by providing features and configurations for generating Android-specific code, such as resources and manifest files, and packaging the application into an APK file.

As you said, there is a lack of specifications about these two in the official documentation (at least from what I've found).

'java-library' is for building java libraries specifically if I'm not wrong and it probably conflicts with using an Android specific plugin like 'kotlin-android'. There a few similar questions across StackOverflow that might give you more details. Hope it helps.

moondev
  • 151
  • 1
  • 4