Search code examples
kotlingradlegroovy

Kotlin equivalent of Groovy Gradle file


With Android Studio "Android Studio Hedgehog | 2023.1.1" Kotlin is the default for Gradle files. An example of part of one of my Groovy build.gradle files is:

dependencies
{   implementation files('libs/jsch-0.1.54.jar')
    implementation project(':potpourri')

The correcponding setting.gradle file is:

include ':app'
include ':potpourri'

project(':potpourri').projectDir = new File(settingsDir, '../Potpourri/app')

My question is: What is the Kotlin equivalents for the potpourri module?


Solution

  • Something like this should work:

    dependencies {
        implementation(files("libs/jsch-0.1.54.jar"))
        implementation(project(":potpourri"))
    }
    

    With in settings.gradle.kts:

    include(":app")
    include(":potpourri")
    
    project(":potpourri").projectDir = File(settingsDir, "../Potpourri/app")
    

    More information about dependecies between sub projects here: https://docs.gradle.org/current/userguide/declaring_dependencies_between_subprojects.html