Thread
#compose
    z

    zoha131

    1 year ago
    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?
    d

    dewildte

    1 year ago
    got some code samples ?
    Simone Summo

    Simone Summo

    1 year ago
    I’m having same issue, anyone have found a solution?
    z

    zoha131

    1 year ago
    @dewildte just create a new project. Some of Kotlin std method is not know by AS
    Simone Summo

    Simone Summo

    1 year ago
    @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
    louiscad

    louiscad

    1 year ago
    @zoha131 which version of the Kotlin plugin and of Android Studio do you have?
    z

    zoha131

    1 year ago
    AS - Canary 14 Kotlin - 1.4.32
    Simone Summo

    Simone Summo

    1 year ago
    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.navigation:navigation-compose:1.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

    zoha131

    1 year ago
    so you're suggesting to use compose beta03 and kotlin 1.4.31 ?
    Ash

    Ash

    1 year ago
    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.satyanov

    d.satyanov

    1 year ago
    @zoha131 you can try to downgrade to AS Canary 13 as described in android-studio channel - link to the message.
    z

    zoha131

    1 year ago
    unfortunately nothing worked for me. Working on my second pc for now. But this is really annoying.
    k

    Kshitij Patil

    1 year ago
    Any solution you found? I read on SO that the issue is fixed in 1.5.0 but Compose doesn't support that yet. It works fine on Kotlin 1.4.30 so idk which Compose version I might need to downgrade.
    Colton Idle

    Colton Idle

    1 year ago
    I ran deep clean script with --nuke option. That fixed it for me.
    k

    Kshitij Patil

    1 year ago
    @Colton Idle can you share your AGP, gradle, kotlin plugin, Android Studio and Compose version?
    Colton Idle

    Colton Idle

    1 year ago
    Everything is latest
    k

    Kshitij Patil

    1 year ago
    I'm assuming by latest of Kotlin, you meant
    1.4.32
    May I know which jvm are you using? pre-bundled, openjdk, oracle? which JDK version, 11,13,15 ?
    Colton Idle

    Colton Idle

    1 year ago
    openjdk11 from adopopenjdk homebrew
    k

    Kshitij Patil

    1 year ago
    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.
    Colton Idle

    Colton Idle

    1 year ago
    Did you run deep clean kotlin script with --nuke option?
    k

    Kshitij Patil

    1 year ago
    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