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'
}
相关推荐
superman超哥10 分钟前
仓颉语言中流式I/O的设计模式深度剖析
开发语言·后端·设计模式·仓颉
豆浆whisky13 分钟前
Go内存管理最佳实践:提升性能的Do‘s与Don‘ts|Go语言进阶(17)
开发语言·后端·golang
Kay_Liang17 分钟前
Spring中@Controller与@RestController核心解析
java·开发语言·spring boot·后端·spring·mvc·注解
l1t19 分钟前
luadbi和luasql两种lua duckdb驱动的性能对比
开发语言·单元测试·lua·c·csv·duckdb
国服第二切图仔20 分钟前
Rust开发实战之使用 Reqwest 实现 HTTP 客户端请求
开发语言·http·rust
weixin_4978455425 分钟前
Windows系统Rust安装慢的问题
开发语言·后端·rust
奔跑吧 android1 小时前
【android bluetooth 协议分析 18】【PBAP详解 2】【车机为何不显示电话号码为空的联系人信息】
android·蓝牙电话·hfp·pbap·电话簿
深盾科技1 小时前
安卓二次打包技术深度拆解:从逆向篡改到防护逻辑
android
4Forsee1 小时前
【Android】消息机制
android·java·前端
骚戴1 小时前
PDF或Word转图片(多线程+aspose+函数式接口)
java·开发语言