I’m following <this guide> to add compose to my ex...
# compose
a
I’m following this guide to add compose to my existing app.. It says
Make sure you're using Kotlin 1.5.21 in your project.
Will Kotlin version
1.5.31
work?
m
I believe the latest version of compose wants
1.5.30
. You can disable the check, and it works with
1.5.31
This is what I did
a
@mkrussel thanks the guides tells me to do
Copy code
plugins {
    id 'org.jetbrains.kotlin:android' version '1.5.21'
}
I didn’t have this on my existing app. is it a new thing?
m
It's another way of doing the plugin. I do it like
Copy code
plugins {
    id("com.android.application")
    id("kotlin-android")
}
a
I only had:
m
But I'm using the Kotlin DSL for gradle and that sample is Groovy, but you need to make sure you are using an android plugin and the kotlin android plugin, which I'm guessing your app already is doing
a
Copy code
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
m
You must be applying plugins in some manner or it wouldn't know how to build an android app.
a
I’m using the groovy DSL has been > 1 year since I set up the ap
my plugins are mostly
implementation
m
Those are dependencies not plugins.
a
Hmm where do I put the plugin?
build.gradle? right
m
yes, and I'm sure you have them or else your would not be building an app
a
@mkrussel i think this was what I had:
apply plugin: 'kotlin-android'
a
Do not suppress Kotlin version check unless you really know what you are doing. I don't think Compose 1.0.1 is compatible with Kotlin 1.5.31. It's just that the versions in the tutorial aren't latest. The latest stable version 1.0.3 supports Kotlin 1.5.31. You can check the latest version here.
a
Is
Copy code
plugins {
    id 'org.jetbrains.kotlin:android' version "$kotlin_version"
}
alternative syntax for:
Copy code
apply plugin: 'kotlin-android'
?
m
I believe so
@Albert Chang The latest version
compose 1.0.3
officially only supports
Kotlin 1.5.30
, but it does work with
Kotlin 1.5.31
. I agree disabling the version check is very risky, which is why I replaced it with my own version check in the gradle script.
a
Getting this @mkrussel am I missing something?
m
Line 6 is already applying the plugin, so just remove the plugin block.
a
I tried removing line 6 with the same error…
m
Keep line 6 and remove the
plugin
portion that is complaining. It is not needed because you have line 6.