apply plugin: ‘kotlin-android’ apply plugin: ‘kotl...
# android
c
apply plugin: ‘kotlin-android’ apply plugin: ‘kotlin-android-extensions’ apply plugin: ‘kotlin-kapt’
b
chanzmao:
kotlin-android
are kotlin plugin for android, the below one is the KAE
kotlin-android-extensions
and… the last one is for
annotationProcessor
just like on Java you usually using the
apt
for generating the class
c
ok
apply plugin: ‘kotlin-android-extensions’
only one line for that?
b
yes, and line for
kotlin-android
is a must for kotlin itself
c
but, how to get kae resources on Android Studio ? no need to download for that resources?
Ok. i see that.
b
for example you have an
id
inside your layout. and in your kotlin class, just type that id and do whatever you want… let say you have id with the name like
btn_submit
and in your kotlin class just type the same thing to set the click listener
btn_submit.setOnClickListener { }
c
apply plugin: ‘kotlin-android-extensions’ dependencies { classpath “org.jetbrains.kotlinkotlin gradle plugin$kotlin_version” classpath “org.jetbrains.kotlinkotlin android extensions$kotlin_version” }
this dependencies block does not need?
b
no, not like that, on your root just put the classpath for
org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version
the
org.jetbrains.kotlin:kotlin-gradle-plugin
are just put on your root gradle file
c
I see. that kotlin’s core main file.
b
yes 🙂
c
classpath ‘org.jetbrains.kotlinkotlin gradle plugin1.1.2-5’
b
yeah, that’s the latest version of the plugin
c
apply plugin: ‘kotlin-android’ apply plugin: ‘kotlin-android-extensions’
b
yes, put that on your
app
gradle file
c
Only three lines on two build,gradle for setting.
1: root
dependencies { classpath ‘com.android.tools.buildG2.3.3’ classpath ‘org.jetbrains.kotlinkotlin gradle plugin1.1.2-5’ // <-- 1 }
b
yes, correct
c
2: app
apply plugin: ‘com.android.application’ apply plugin: ‘kotlin-android’ // <-- 2 apply plugin: ‘kotlin-android-extensions’ // <-- 3 apply plugin: ‘kotlin-kapt’
OK!
I will do that! Thanks!
You’re so generouns/
^w^
Are you using AS 3.0 Canary ?
b
heheheh, nope 🙂
no, I’m just a user for Android Studio, dont want to take a risk further… so still using the stable version. currently 2.3.3
c
I think so.
I am using 2.3.3, too.
I want to convert all code to Kotlin, but a little mysterious about some third party libraries.
Aren’t you using retrolambda or RxJava ?
b
yes, on my previous project I’m using the RxJava. but you don’t need retrolambda in kotlin. because kotlin can do lambda function better than that 🙂
you don’t have to convert all of your code into kotlin, you can do it one by one bro
c
yes, i will challenge it one by one.
Thanks, do you have facebook account?
b
c
Ok. I follow you.
Let’s talk some other time.
Now sent friend request.
If you see it, please allow me.
bye.