m

    Marko Novakovic

    1 year ago
    how and where to apply
    plugins {
        id("org.jetbrains.kotlin.android") version "1.5.21"
    }
    ? if I add it anywhere everything falls apart and I can’t run app any more. modules disappear am trying to adopt Compose, is this required or not?
    k

    kevindmoore

    11 months ago
    I usually have something like this in the app build.gradle file:
    plugins {
      id("com.android.application")
      kotlin("android")
    }
    I specify the version in the top level gradle file in the classpath
    e

    ephemient

    11 months ago
    I prefer to use
    settings.gradle.kts
    to manage plugin versions,
    pluginManagement {
        plugins {
            resolutionStrategy {
                eachPlugin {
                    val id = requested.id.id
                    when {
                        id.startsWith("com.android.") ->
                            useModule("com.android.tools.build:gradle:7.0.2")
                        id.startsWith("org.jetbrains.kotlin.") -> useVersion("1.5.31")
                    }
                }
            }
        }
    }
    then you can
    plugins { id("com.android.application"); kotlin("android") }
    in any
    build.gradle
    script without having to think about versions
    m

    Marko Novakovic

    11 months ago
    I used to do it like that, inside
    settings.gradle.kts
    but when I did it messed up whole build. I made it work tho