kotlin项目引用

概要:

记录项目引用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"
        //引用kotlin
        classpath "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 30
    buildToolsVersion '30.0.1'

    defaultConfig {
        applicationId "com.ljt.retrofitobject_xiaoma"
        minSdkVersion 26
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    //引用kotlin
    implementation "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'
}
相关推荐
m0_740043734 分钟前
Axios拦截器 -- 请求拦截器和响应拦截器
开发语言·前端·javascript
zhangphil10 分钟前
Android性能:trace上的锁竞争monitor contention with owner at
android
程序修理员22 分钟前
java+vue实现文件下载进度条
java·开发语言·vue.js
梁正雄27 分钟前
10、Python面向对象编程-2
开发语言·python
Jo乔戈里31 分钟前
Python复制文件到剪切板
开发语言·python
砖厂小工37 分钟前
Now In Android 精讲 9 - Benchmark 与 Baseline Profile
android
任子菲阳44 分钟前
学Java第五十三天——IO综合练习(1)
java·开发语言·爬虫
繁华似锦respect1 小时前
单例模式出现多个单例怎么确定初始化顺序?
java·开发语言·c++·单例模式·设计模式·哈希算法·散列表
码农很忙1 小时前
让复杂AI应用构建像搭积木:Spring AI Alibaba Graph深度指南与源码拆解
开发语言·人工智能·python
渡我白衣1 小时前
计算机组成原理(1):计算机发展历程
java·运维·开发语言·网络·c++·笔记·硬件架构