概要:
记录项目引用kotlin具体事项
1 object下build.gradle
buildscript {//声明引用版本ext.kotlin_version = "1.4.20"repositories {google()mavenCentral()}dependencies {classpath "com.android.tools.build:gradle:4.2.0"//引用kotlinclasspath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"}
}
2 APP下build.gradle
plugins {id 'com.android.application'//声明引用kotlin插件id 'kotlin-android'id 'kotlin-android-extensions'
}android {compileSdkVersion 30buildToolsVersion '30.0.1'defaultConfig {applicationId "com.ljt.retrofitobject_xiaoma"minSdkVersion 26targetSdkVersion 30versionCode 1versionName "1.0"testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"}buildTypes {release {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'}}compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}kotlinOptions {jvmTarget = '1.8'}
}dependencies {//引用kotlinimplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"implementation 'androidx.core:core-ktx:1.3.1'implementation 'androidx.appcompat:appcompat:1.2.0'implementation 'com.google.android.material:material:1.2.1'implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
}