Android/Kotlin

anko 라이브러리 설치하기

lipnus 2019. 4. 22. 13:57
반응형

anko 설치하기

android kotlin에서 사용할 수 있는 유용한 라이브러리.


Github: https://github.com/Kotlin/anko

Wiki: https://github.com/Kotlin/anko/wiki


다음과 같은 4가지로 나누어져 있다. 

  • Anko Commons: a lightweight library full of helpers for intents, dialogs, logging and so on;
  • Anko Layouts: a fast and type-safe way to write dynamic Android layouts;
  • Anko SQLite: a query DSL and parser collection for Android SQLite;
  • Anko Coroutines: utilities based on the kotlinx.coroutines library.


각각 설치할 수도 있다.
아래의 방법은 통합해서 다 설치하는 것.





Gradle: Module

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

//Anko
implementation "org.jetbrains.anko:anko:$anko_version"
}


Gradle: Project

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.11'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
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 {
google()
jcenter()

}
}

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

//Anko버전 설정
ext.anko_version='0.10.8'


반응형

'Android > Kotlin' 카테고리의 다른 글

함수를 매개변수로 사용하기  (0) 2019.05.14
let, apply, run, also, with 구분하기  (0) 2019.04.22
제네릭 함수  (0) 2019.04.19
칸이 차면 다음으로 넘어가는 EditText  (0) 2019.04.04
다이얼로그(Alert Dialog)  (0) 2019.04.02