https://kotlinlang.org logo
#compose
Title
# compose
j

Julius Marozas

07/23/2020, 9:52 PM
I am having an issue with the new Compose version (0.1.0-dev15) in Android Studio. My project builds fine, but Studio shows warnings near things such as `MaterialTheme.colors.surface`:
Copy code
'surface: Color' is only available since Kotlin 1.4 and cannot be used in Kotlin 1.3
I have also set the "Update channel" in Languages & Frameworks > Kotlin (Android Studio settings) to "Early Access Preview 1.4.x".
a

allan.conda

07/24/2020, 5:57 AM
j

Julius Marozas

07/24/2020, 6:08 AM
Yeah, I've already done that. However, I am using Gradle Kotlin DSL, maybe that's where the problem is? I have also defined Kotlin version in a different Kotlin file as a constant. So perhaps Android Studio fails to resolve the version for some reason, even though Gradle builds with no problems.
p

ppvi

07/24/2020, 1:47 PM
@Julius Marozas did you find a solution?
j

Julius Marozas

07/24/2020, 1:53 PM
No, but I was thinking that I could hardcode the Kotlin version instead of using a constant. Maybe that could fix it? I will try it later today.
p

ppvi

07/24/2020, 1:53 PM
Make sure you've updated kotlinCompilerVersion
check out jetnews
also, does the app succeed when building from CLI?
j

Julius Marozas

07/24/2020, 10:03 PM
@ppvi Sorry for the late response. I couldn't find a way to fix the errors in Android Studio. I have already updated
kotlinCompilerVersion
and
kotlinCompilerExtensionVersion
and the app builds without errors with
gradle assembleDebug
.
@ppvi I think I fixed it! I added the following to
kotlinOptions
in
KotlinCompile
task:
Copy code
languageVersion = "1.4"
Maybe this can be added to the documentation?
p

ppvi

07/25/2020, 9:28 AM
jetnews works and it has the same setup as the docs
j

Julius Marozas

07/25/2020, 9:38 AM
Strange, because I get errors without specifying
languageVersion
. Perhaps something is working differently in Kotlin Gradle scripts
build.gradle.kts
than with normal Gradle scripts
build.gradle
?
a

Adrian Blanco

07/26/2020, 3:04 PM
Seconded. I had to add languageVersion as well to get dev15 to work. I am using a lot of modules, with a bit of Gradle kts
3 Views