AndroIDStudio kotlin配置
安装插件
file -> Settings -> Plugins -> browse repositorIEs -> 搜索 kotlin
gradle添加依赖
Module的build.gradle
apply plugin: 'com.androID.application'apply plugin: 'kotlin-androID'apply plugin: 'kotlin-android-extensions' androID { compileSdkVersion 25 buildToolsversion "25.0.2" defaultConfig { applicationID "com.lxs.kotlinconfig" minSdkVersion 15 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']) androIDTestCompile('com.androID.support.test.espresso:espresso-core:2.2.2',{ exclude group: 'com.androID.support',module: 'support-annotations' }) compile 'com.androID.support:appcompat-v7:25.3.1' compile 'com.androID.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12'<br> compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"} repositorIEs { maven {url 'http://maven.aliyun.com/nexus/content/groups/public/'}}
Project的build.gradle
buildscript { ext.kotlin_version = '1.1.2-4' repositorIEs { 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 { maven {url 'http://maven.aliyun.com/nexus/content/groups/public/'} }} task clean(type: Delete) { delete rootProject.buildDir}
kotlin.incremental=true增量编译的机制,可以加快编译速度 项目根目录的gradle.propertIEs里配置
把Java代码转换成kotlin代码
Code -> Convert Java file to Kotlin file
快捷键 ctrl+alt+shift+k
或者ctrl+shift+A 输入Convert Java file to Kotlin file
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
总结以上是内存溢出为你收集整理的AndroidStudio kotlin配置详细介绍全部内容,希望文章能够帮你解决AndroidStudio kotlin配置详细介绍所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)