Android Studio java代码中添加kotlin混合开发
1.项目的build.gradle中添加kotlin-gradle-plugin
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
2.模块的build.gradle中应用kotlin插件和添加依赖库
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'文章来源:https://www.toymoban.com/news/detail-418763.html
dependencies {
implementation 'androidx.core:core-ktx:1.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20"
}
文章来源地址https://www.toymoban.com/news/detail-418763.html
到了这里,关于Android java项目添加kotlin混合开发环境配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!