Member-only story

Android/Kotlin Series: [#03] Kotlin plugin should be enabled before “kotlin-kapt”

Leo N
2 min readFeb 5, 2020

--

1. Why did it happen?

Kotlin plugin doesn’t pick up annotationProcessor dependencies, So we have to use kapt dependencies with kotlin-kapt. Use the latest version of Kotlin annotation processor put this line at top of your module’s level build.gradle file As the message says, all you have to do is you have to enable Kotlin plugin before kotlin-kapt in app\build.gradle. The plugin contents of app\build.gradle the file before solving this issue are shown below.

2. How to solve it?

Now we will change the order of kotlin-kapt and kotlin-android with kotlin-android coming prior to kotlin-apt.

Change

apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'

to

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

Thanks for:

Thanks for reading, please feel free to comment on this post

--

--

Leo N
Leo N

Written by Leo N

🇻🇳 🇸🇬 🇲🇾 🇦🇺 🇹🇭 Engineer @ GXS Bank, Singapore | MSc 🎓 | Technical Writer . https://github.com/nphausg

No responses yet