-
Notifications
You must be signed in to change notification settings - Fork 104
Android Preview #18
base: main
Are you sure you want to change the base?
Android Preview #18
Conversation
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = "1.5.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move Compose compiler version to gradle.properties?
Or even reuse Compose Multilatform Compiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even reuse Compose Multilatform Compiler?
the versions usually don't match, we can't reuse them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there are issues when we add this to our template:
- we apply 2 Compose compiler plugins (androidx one, and jetbrains one). It is not obvious, which will be applied
- the jetbrains Gradle plugin applies compiler plugin depending on the Kotlin version. If we downgrade Kotlin to 1.8.21, the Gradle plugin will apply jetbrains compose compiler 1.4.*, but because the android compiler is hardcoded now, android won't compile
- it adds an additional action when we need to update templates - we should map the compilers and add an appropriate version.
So, we can't officially recommend this approach yet. Only as a workaround if users need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible reliable solutions:
- add an internal mapping Kotlin -> androidx compiler, and apply
buildFeatures
+composeOptions
implicitly in the Gradle plugin - exclude applying androidx compiler somehow, and always apply jetbrains compiler
Both require changes in our Gradle plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do other target work with this change? I'm wondering if different compose compiler plugins don't mixup.
Or even reuse Compose Multilatform Compiler?
Ideally, Compose Multilatform Compiler should work for anroid too. I'm just not sure if we can configure it in android.composeOptions...
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, Compose Multilatform Compiler should work for anroid too
I even say - must work, and it is how it works for Android now.
Usage of androidx compose compiler also enables us to use AS Layout Inspector for Compose Multiplatform composables written in common code. I noticed this after bumping Kotlin version to 1.9.0 and compose mp 1.5.0-beta01, before that, it wasn't possible for me. You can test it in this version of my repo. (those one, two commits initially helped me, essentially the same what you did in this PR) Thus, maybe we can change the name of this PR, so people know it's possible. |
Resolves Issue JetBrains/compose-multiplatform#3499
And workaroung Issue JetBrains/compose-multiplatform#3531
Added Android Preview in shared module