android kotlin gradle.build

Here skeleton of gradle.build script for madness people who try to code Android apps using kotlin language.

This gradle script uses another structure of subdirectories, more simple I would say. There is no useless “deep” folders like src/main/java, src/main/assets, etc..


buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.10.770'
}
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'idea'

repositories {
mavenCentral()
}

dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib:0.10.770'
}

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 15
targetSdkVersion 21
}

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['java', 'kotlin']
aidl.srcDirs = ['java']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}


Subfolders structure are pretty same as for non-gradle project:


project
/kotlin - kotlin sources
/java - java sources
/res - application resources
/assets - app assets
/libs - jar files you can't find in any public repos, like flurry analytics
/AndroidManifest.xml
/gradle.build - this file