项目构建
app.gradle
apply plugin: 'com.android.application'apply plugin: 'kotlin-android'apply plugin: 'kotlin-android-extensions'android { compileSdkVersion 25 buildToolsVersion "25.0.3" defaultConfig { applicationId "com.example.feint.kotlin_android_start" minSdkVersion 23 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8' testCompile 'junit:junit:4.12'// androidTestImplementation 'com.android.support.test:runner:0.5'// androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'}
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript { ext.kotlin_version = '1.1.3-2' repositories {// google()// jcenter() maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories {// google()// jcenter() maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} } } task clean(type: Delete) { delete rootProject.buildDir }