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']
        }
    }
}

Read more