Kotlin/Android/Gradle

Has anyone had any luck building Kotlin for Android with the new build system (Gradle)? This is the basic setup:

buildscript {   repositories {   mavenCentral()   maven {            url 'http://repository.jetbrains.com/all'   }   }   dependencies {   classpath 'com.android.tools.build:gradle:0.4'   classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.1-SNAPSHOT'   } } apply plugin: "kotlin" apply plugin: 'android'

repositories {
  mavenCentral()
  maven {
  url ‘http://repository.jetbrains.com/all
  }
}

dependencies {
  compile files(‘libs/android-support-v4.jar’)
  compile ‘org.jetbrains.kotlin:kotlin-stdlib:0.1-SNAPSHOT’
}

android {
  compileSdkVersion 17
  buildToolsVersion “17.0.0”

  defaultConfig {
  minSdkVersion 7
  targetSdkVersion 16
  }

  tasks.withType(com.android.build.gradle.tasks.PackageApplication) {
  pkgTask -> pkgTask.jniDir new File(projectDir, ‘libs’)
  }
}

This leads to the following error:

Gradle: A problem occurred configuring project ‘:MyApp’.
> Failed to notify project evaluation listener.
  > The ‘java’ plugin has been applied, but it is not compatible with the Android plugins.

I’m just getting up to speed with Gradle, so I’m not exactly sure how one might work around this (or if it’s even possible)

Since Andriod's Gradle is rather peculiar, we have to essentially build a separate Gradle plugin for Kotlin on Android. We are working on it, you can contribute if you feel like it.

I'll take a look for sure. It's in the main kotin repo or is there a separate one for gradle?

This is a link to source code of kotlin-gradle-plugin: https://github.com/JetBrains/kotlin/tree/master/libraries/tools