pajatopmr

    pajatopmr

    3 years ago
    So I am trying to add the Android platform to a multiplatform library using IntelliJ. Is there an example that shows the Gradle build script using Kotlin that someone would care to recommend? Gradle version is 5+ fwiw.
    My first dilemma is in trying to come up with a version for the com.android.library plugin. Would that be the Android version, like 28.0.0? Second dilemma is the repository to use to access the plugin. Wouldn’t that be google()?
    t

    thevery

    3 years ago
    russhwolf

    russhwolf

    3 years ago
    The
    com.android.library
    plugin version would be
    3.3.2
    if you want the latest stable version, or
    3.4.x
    or
    3.5.x
    if you’re using a beta or canary Android Studio. And yes,
    google()
    is the repository you want
    Ildar’s link will give you more configuration hints
    pajatopmr

    pajatopmr

    3 years ago
    @thevery @russhwolf Sorry I did not get this across more clearly but the goal is to use a Kotlin script rather than a Groovy script. And IntelliJ rather than Android Studio.
    t

    thevery

    3 years ago
    IJ vs AS doesn't matter for build script
    louiscad

    louiscad

    3 years ago
    Here's an Android targetting only "multiplatform" library example that relies of the content of the
    buildSrc
    of that same project: https://github.com/LouisCAD/Splitties/blob/master/modules/toast/build.gradle.kts
    russhwolf

    russhwolf

    3 years ago
    https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html has code samples in both Kotlin and Groovy if you need help translating.
    pajatopmr

    pajatopmr

    3 years ago
    @russhwolf this doc elides out the translation details much to my chagrin. 😞 However, the @louiscad Splitties repo does an excellent job showing the translations, but it took some digging to find them. Splitties is a great teaching resource.
    louiscad

    louiscad

    3 years ago
    I could do it only thanks to the doc Russell linked 🙂