본문 바로가기

Programming/Android

Kotlin 설치

아 사실 코틀린에 대해 알고는있었지만, 굳이 꼭 사용해야 할 필요는 있을까가 내 생각이었는데....


구글에서 이렇게 발표를 해버릴 줄이야-_-;;;


이러다 JetBrains를 인수하는게 아닌지...


아무튼 고런관계로 우선 플러그인부터 설치는 해봄


// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-3'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.guava:guava:20.0'
classpath "io.realm:realm-gradle-plugin:3.0.0"
classpath 'com.google.gms:google-services:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
}
/*
task clean(type: Delete) {
delete rootProject.buildDir
}
*/

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
}
repositories {
mavenCentral()
}

설치 후 약간의 에러가 발생함

Gradle sync failed: Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed.


알맞은 해결방법인지는 모르겠지만 지금 task clean부분을 주석처리해주니 에러가 사라짐


코틀린 문서를 보면 java를 100%호환한다고는 되어있고, java to kotlin으로 convert가 가능할 수 있게 되었다.


다만 기존 작업에 해놓을 걸 다 바꾸었다가 문제가 생기면 귀찮아지므로... 새로 만드는 작업을 코틀린으로 해보고 별 문제가 없는 것 같으면


java to kotlin을 해볼 예정


코틀린 공식사이트

https://kotlinlang.org/docs/reference/

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

Kotlin 사용시 주의사항?  (0) 2017.05.30
Kotlin 사용 (1) - singleton (Rx EventBus용)  (0) 2017.05.26
Realm 과 Jack Option  (0) 2017.05.19
Glide Svg 이미지관련  (0) 2017.05.19
RealmList와 Realm + Rx2 사용 이슈  (0) 2017.05.19