AndroidStudio2.x配置Kotlin

40 篇文章 0 订阅

AndroidStudio 在3.x默认支持 kotlin,但是 目前3.0只是预览版 如果使用AndroidStudio2.x的 话,就需要进行配置

项目 build文件


apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'//-----注意

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.demokotlin"
        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'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" //-----注意
}
repositories {
    mavenCentral()
}


根目录build文件

buildscript {
    ext.kotlin_version = '1.1.3-2' //注意
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        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 {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android Studio 3.2 Development Essentials – Kotlin Edition 版本: Developing Android 9 Apps Using Android Studio 3.2, Kotlin and Android Jetpack By 作者: Neil Smyth ISBN-10 书号: 0960010939 ISBN-13 书号: 9780960010936 出版日期: 2018-12-06 pages 页数: (1037) Assuming you already have some programming experience, are ready to download Android Studio and the Android SDK, have access to a Windows, Mac or Linux system and ideas for some apps to develop, you are ready to get started. 1. Introduction 2. Setting up an Android Studio Development Environment 3. Creating an Example Android App in Android Studio 4reating an sngdroid vurtual bevice tsvb in Android tudlo 6. ATouroftheAndroid studio user terface 7. Testing Android Studio Apps on a Physical Android Device 8. The Basicsofthe Android Studio Code Editor 10. The Anatomy of an Android Application 11. An Introduction to Kotlin 12. Kotin Data Types, VariablesandNullablty 1A katHnHwCaLCd 15. An Overview of Kotin Functions andLambdas 16. The Basics of Object Oriented Programming in Kotlin 18. Understanding Android Application and Activity Lifecycles 19. Handling Android Activity state Changes 20. Android Activity State Changes by Example SJOOVImgOgheStoung nenEian Anurou agtuy. 23. AGuide to the Android Studio Layout Editor Tool 24.A Guide to the Android ConstraintLayout 26. Wartinowith constaimtLayout chansand Ratiosin AndroidStudi. Z7. An Android Studio Layout Edtor ConstraintLayout Tutorial 28. ManualXML Layout Designin Android Studio 42-Managing constraintsysing constraint sets 31. AGuide to using Instant Run in Android Studio 32. An Overview and Example of Android Event Handling AnMCCCCcMaTMCLEOLDY CDaCorc. 35. Implementing Custom Gesture and Pinch Recognition on Android 36. An Introduction to Android Fragments 37. Using Fragmentsin Android Studio-An Example 39. An Android letpack viewModel Tutorial 40. An Android Jetpack LiveData Tutorial 41. An Overview of Android Jetpack Data binding 43. Working with Android Lifecycle-Aware Components 44. An Android JetpackLifecycle Awareness Tutorial 45. An Overview of the Navigation Architecture Component 47. CreatingandManaaing overflow Menus. on Android 48. Animating User Interfaceswith the Android Transitions Framework 49. An Android Transition Tutorial using beginDelayedTransition sI wWatinawthbthe Fbatino A-tionBaittan andsnactbar 52. Creating a Tabbed Interface using the TabLayout Component 53. Working with the ReyclerView and CardViewWidgets A ANAOCTOLLIHECYCIETYISNODCOrCYew ItOrial 56. Working with the AppBar and Collapsing Toolbar Layouts 57. Implementing an Android Navigation Drawer 2 AnAndrOid StUWIO MaSteruOetalFlow Iutorial 60. Android Explicit Intents-A Worked Example 61. AndroidlmplicitIntents-A Worked Example O4AngTOIO brOadCast Intents and broaacast ihecewers 64. AnOverview of Android Startedand Bound Services 65. Implementing an Android Started Service -A WorkedExample bC. Ancdroidtocalbound Services -A WorkedExample 68. An Android Notificatons Tutorial 69. An Android Direct Reply Notification Tutorial . AnhTrcdwto. to AntowMtutiindewpi . cbom ritoal Z. AnoenwewofAndrad solteoatdbases L 73. The Android Room Persistence Library 74. An Android Tablelayoutand TableRow Tutorial 76. Acesing Cloud Storage using the Android Storage Acces Framework 7. An Android Storage Aces Framework Example 78. Implementing VideoPlaybackon Androidusing the VideoViewand Mediacontroller Clases 80. An AndroidPicture in-Picture Titorial 81. Video Recording and Image Capture on Android using Camera lntents 82. Making Runtime Permision Requestsin Andraid 6. Ancdtonubuctirfecordingoandthaybackwinghediarbyerangdhecdatecorder 85. Printingwith the Android Printing Framework 86. An Android HTML and Web Content Printing Example RAC-CC. CCACGCLXCCH-CIN9 89. An Android Studio App Links Tutorial 90. An Introduction to AndroidInstantApps 2. AMbspwtngwn Andfoasudoporectornstants. Apps 93. AGuicde tothe Android studioProfler 94. An Android Biometric Authentication Tutorial 5. Creating, TestinganduploacinganAncroidAppBunde

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值