Kotlin-android Gradle plugin for android libraries



Has anybody managed to compile an android library with gradle?

I have tried to use the ‘kotlin-android’ plugin, but it seems to only work for android modules, not android library modules.

I get the following error:

Gradle: Execution failed for task ‘:cloud:compileDebugKotlin’.
> Plugin with id android has not been used.

I looked at the code for the plugin, and I think I found the source of the problem:

KotlinPlugin.kt:line 244

It calls project.getPlugins().getPlugin(“android”) and expects null if “android-library” is used, in which case it then calls getPlugin(“android-library”)

According to the gradle doc, getPlugin() throws an exception instead of returning null. .hasPlugin() should be used instead to check if a plugin is used or not.

I have created an issue in youtrack:


Thank you for detailed report! Feel free to fix it and send us a pull request :)



Thanks for reporting the issue. Fix is on the way.


Fixed in kotlin-gradle-plugin ver. 0.6.69

Thanks again for the report!