skip to Main Content

I just update my Android Studio after a long time. There are three options and Kotlin DSL with recommended quote.

I always code in Java only. So any changes come if I select in Kotlin. Because I never use Kotlin, and their first Activity class come with Kotlin.

enter image description here

I do not know Groovy/Kotlin language. In future, I want to add any SDK all of their documentations will be in maybe Groovy, then I will face difficulty to add that in Kotlin DSL or not?

2

Answers


  1. It is a choice related to build.gradle management.

    What is DSL

    A DSL is a computer language designed for a specific problem domain.
    It is created to address the needs of a particular industry or
    application. For example, a DSL for statistical analysis might include
    features that make it easy to write and manipulate data sets. A DSL
    for music composition might include features for writing and arranging
    notes and chords.

    DSLs are not general-purpose programming languages. They are designed
    to be used in a specific domain and provide a more natural and
    intuitive way to write code in that domain. DSLs can be embedded in
    general-purpose programming languages, or they can be stand-alone
    languages.

    Kotlin DSL

    You use kotlin dsl in build gradle management. It is equivalent to using Kotlin programming language.

    Kotlin DSLs are DSLs that are written in the Kotlin programming
    language. They allow developers to create a language that is specific
    to their problem domain quickly and easily.

    Groovy DSL

    You use groovy dsl in build gradle management. It is equivalent to using Groovy programming language.

    The Groovy DSL is a wrapper and extension to Java DSL. The main goal
    we pursue here is to make Spring Integration development on Groovy as
    smooth and straightforward as is it possible with interoperability
    with existing Java DSL and some Groovy extensions or language-specific
    structures.

    Login or Signup to reply.
  2. Kotlin DSL: You write your gradle build files in a kotlin dsl and therefore you can use kotlin: see this primer

    Kotlin DSL + Version Catalogs: You still write your gradle build files in kotlin dsl, but the dependency versions are kept in a version catalog file. This helps to share version codes, see this site

    Groovy DSL: The "old" way of writing gradle build files, here the dsl is written in groovy and you can write groovy code.

    To answer your question, you can choose any of them and you can add any dependency, no matter what they are using.

    The gradle documentation also provides the option to see sample code in either kotlin or groovy:
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search