I am facing a weird issue where AS can’t understan...
# compose
z
I am facing a weird issue where AS can’t understand basic Kotlin features. e.g.
contains(), count()
methods on String and
listOf(), forEach()
methods for collections. Have anyone faced this issue recently?
2
d
got some code samples ?
s
I’m having same issue, anyone have found a solution?
z
@dewildte just create a new project. Some of Kotlin std method is not know by AS
s
@zoha131 I’m having this problem on AS Canary, I’m trying different combinations between AS, gradle plugin and kotlin… I will let you know if I found one that is working
l
@zoha131 which version of the Kotlin plugin and of Android Studio do you have?
z
AS - Canary 14 Kotlin - 1.4.32
s
I think I’ve found the solution, the problem is Kotlin 1.4.32. You have to avoid importing this, or have dependencies that import it. Compose Beta 04 is one of those.
If you have it avoid also androidx.navigationnavigation compose1.0.0-alpha10. Most important thing is to check your app dependencies, and see that you don’t have
org.jetbrains.kotlin:kotlin-stdlib:1.4.32
or
org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32
z
so you're suggesting to use compose beta03 and kotlin 1.4.31 ?
a
super annoying! Preview says it can not render but it is working perfect. AS can not resolve
listOf
but app runs perfect ... has anyone solved this? Currently working with Compose Beta05 and Android Studio Arctic Fox | 2020.3.1 Canary 14 Build #AI-203.7717.56.2031.7260174. To reproduce just build a new project and check "use Kotlin script (.kts) for Gradle build files"
d
@zoha131 you can try to downgrade to AS Canary 13 as described in android-studio channel - link to the message.
👍🏽 1
z
unfortunately nothing worked for me. Working on my second pc for now. But this is really annoying.
c
I ran deep clean script with --nuke option. That fixed it for me.
k
@Colton Idle can you share your AGP, gradle, kotlin plugin, Android Studio and Compose version?
c
Everything is latest
k
I'm assuming by latest of Kotlin, you meant
1.4.32
👍 1
May I know which jvm are you using? pre-bundled, openjdk, oracle? which JDK version, 11,13,15 ?
c
openjdk11 from adopopenjdk homebrew
k
I'm working on multi-module project and the only "android-application" module is not recognizing Kotlin Collection methods. Any idea why this might be happening? I checked for conflicting dependencies but couldn't find any.
c
Did you run deep clean kotlin script with --nuke option?
k
Yes.. ran it multiple times, for different versions of AS. My other 'android-library' modules are able to detect Kotlin Collection methods but only 'android-application' is giving hard time. I don't find anything conflicting in the
build.gradle
files of these modules
I even tried deleting
~/.gradle/caches
and re-downloading all the dependencies
😭 1