Install packages in kotlin?

Hi there!
I come from python and I would like to learn Kotlin.
Is there a tutorial/resource that shows how to use gradle to install packages in Kotlin?

Thank you!

You don’t really “install” dependencies. You add e.g.:

dependencies {
    implementation("com.example.mylib:mylib:1.0.0")
}

And then the library becomes available to your code. In IntelliJ you need to reload gradle config to make them visible.

Do I add the dependencies line in my main.kt file? Should I create a gradle config file in my project?
Total newbie here to Kotlin and java world :flushed:.

The dependencies system seems a bit complicated. For example do I absolutely need IntelliJ or can I keep using vscode and still be able to install dependencies?

I would like to make a little CLI just to understand the language, but I am stuck with the dependencies system and online I could not find anything clear. Somehow the dependencies system is given for grated…

There’s a nice guide on gradle docs about how to start a project:
https://docs.gradle.org/current/samples/sample_building_kotlin_applications.html

2 Likes