国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > Android > 正文

AndroidStudio kotlin配置詳細(xì)介紹

2019-10-23 18:27:42
字體:
供稿:網(wǎng)友

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增量編譯的機(jī)制,可以加快編譯速度 項(xiàng)目根目錄的gradle.properties里配置

把Java代碼轉(zhuǎn)換成kotlin代碼

Code -> Convert Java File to Kotlin File

快捷鍵 ctrl+alt+shift+k

或者ctrl+shift+A  輸入Convert Java File to Kotlin File

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!


注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到Android開發(fā)頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 清镇市| 灵寿县| 天等县| 米泉市| 吴旗县| 临武县| 东乡县| 天门市| 甘德县| 通城县| 大同县| 奉贤区| 赤城县| 宜兰市| 富源县| 毕节市| 六枝特区| 盐源县| 温宿县| 宜春市| 台中县| 西乌珠穆沁旗| 晋城| 安西县| 平山县| 赤水市| 鄱阳县| 射阳县| 金山区| 手机| 洛川县| 南江县| 平舆县| 赣州市| 邯郸市| 库伦旗| 平远县| 若尔盖县| 南丹县| 聂拉木县| 庄浪县|