Currently, the kotlin-android Gradle plugin does not work with the next-generation Android gradle plugin, which supports native code and better script execution times. To verify this, clone the git repository at:
Then use Android Studio to open one of the projects contained in that repository (I chose hello-jni). Compiling the project should work, but it will not after adding the following to app/build.gradle:
apply plugin: 'kotlin-android'
Error:(2, 0) Extension with name ‘android’ does not exist. Currently registered extension names: [ext, sources, binaries, defaultArtifacts, reporting, buildTypes, flavors, toolChains]
Where (2,0) is the location of the “apply kotlin-android” line in build.gradle. My guess is that this is because the redesigned DSL they’re moving to for the Android plugin contains several changes - the most relevant of which is that “android” has been renamed to “model.android”.
I understand that it’s very fast-moving, prerelease software, so I don’t want to make a feature request to add support for this. I am wondering, however, if any Gradle experts might be able to chime in with a workaround that can perhaps point the Kotlin plugin to the information it’s looking for from the original Android plugin.