I am having an issue with the new Compose version ...
# compose
j
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
j
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
@Julius Marozas did you find a solution?
j
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
Make sure you've updated kotlinCompilerVersion
check out jetnews
also, does the app succeed when building from CLI?
j
@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
jetnews works and it has the same setup as the docs
j
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
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