https://kotlinlang.org logo
Join Slack
Powered by
# library-development
  • m

    mbonnin

    07/29/2025, 9:36 AM
    KMP library authors, did you bump your KGP to 2.2 already?
    👌 6
    l
    • 2
    • 5
  • j

    joseph_ivie

    07/30/2025, 9:45 PM
    Just submitted KiteUI and service abstractions to the Kotlin Foundation Grant program. I'm not terribly hopeful honestly, but still excited!
    🙌 3
    c
    r
    • 3
    • 2
  • m

    Mez Pahlan

    08/03/2025, 7:14 AM
    Hello 👋. I've been thinking about the challenges of maintaining backwards compatibility in libraries and wondered at what points would you use the Deprecation Levels? I've been using
    WARNING
    by default and then removing the signatures on a major version bump. But why, for example, shouldn't I just mark everything as
    HIDDEN
    by default? What approaches do you take?
    m
    j
    z
    • 4
    • 5
  • m

    mbonnin

    08/10/2025, 12:42 PM
    I'm switching to the new KGP-based abi validation. Is this on purpose that
    checkLegacyAbi
    is not a dependency of
    build
    anymore? My CI builds are mostly running
    ./gradlew build
    so they have effectively not been checking the ABI any more.
    r
    • 2
    • 1
  • m

    mbonnin

    08/10/2025, 12:44 PM
    Also somewhat related,
    legacy
    feels weird, my current ABI is not "legacy", it's just a tiny bit "older" than the tip of
    main
    r
    s
    • 3
    • 39
  • a

    Abhimanyu

    08/13/2025, 9:00 AM
    Hi all 👋 , In this talk by Arkadii Ivanov about Kotlin Library compatibility -

    https://youtu.be/dI07ZvnwZgE?si=4DAW9GLItbe-rIuMâ–¾

    . It is mentioned that a method changing to
    synthetic
    is ABI compatible. Could anyone please help share some resources about this?
    m
    e
    • 3
    • 7
  • a

    Abhimanyu

    08/25/2025, 11:29 AM
    Hi all 👋 , Should we exclude generated files from databinding, dagger, etc in API dump when using kotlin binary compatibility validator plugin?
    m
    d
    • 3
    • 5
  • c

    CLOVIS

    08/29/2025, 10:08 AM
    Is https://search.maven.org/ down? No matter what I search, it doesn't find any results
    m
    j
    • 3
    • 14
  • m

    mbonnin

    08/30/2025, 1:16 PM
    How do you organize your package names? Do you do 1 artifact == 1 packageName? Or is it OK to reuse packageNames between artifactIds?
    h
    e
    +2
    • 5
    • 18
  • m

    Matt Nelson

    09/28/2025, 1:07 PM
    Need API advice. Have a library, kmp-file , and want to add an async API in order to support more Js/WasmJs functionality. • Currently, only supporting use of
    Node.js
    synchronous API under the hood. • Adding the Async API would allow use of
    Node.js
    callback API. • Adding the Async API would allow supporting (in a limited context such as WebWorkers) browser functionality. For Js/WasmJs I need the
    suspendCancellableCoroutine
    function from
    kotlinx-coroutines
    All other targets (Jvm/Native) would simply call the blocking functions from their
    xxxAsync()
    actual function definitions Should I 1. Suck it up and add the
    kotlinx-coroutines
    dependency to the Js/WasmJs source sets 2. Expose public functions for Js/WasmJs with a
    Continuation
    argument marked as
    @OptIn(InternalApi::class)
    and have a separate extension module
    kmp-file:async
    with the
    kotlinx-coroutines
    dependency and all
    xxxAsync()
    functions defined. 3. Something else? Like wrapping the callback function from Kotlin in
    js("async { block() }")
    I would really like to avoid the additional dependency...
    z
    r
    w
    • 4
    • 9
  • i

    iseki

    09/29/2025, 10:05 PM
    I have a question, do the kotlinx-io contributors work on the library full time, or as a side project? Seems the library still has a lot of works to do.
    g
    f
    • 3
    • 7
  • b

    Ben Woodworth

    10/02/2025, 9:32 PM
    On KMP with interfaces, is binary compatibility preserved if I add a new member as long as the new member has a body? The answer seems to be yes (at least on the multiplatform targets I tested with), but I wasn't able to find any reassurance while poking through documentation
    a
    • 2
    • 4
  • r

    russhwolf

    10/08/2025, 4:11 PM
    Anyone have experience with binary compatibility tooling in a mixed java/kotlin codebase? Is using binary-compatibility-verifier sufficient for tracking both Java and Kotlin changes, or is there Java-specifiic tooling I should consider as well?
    m
    • 2
    • 8
  • c

    Colton Idle

    10/11/2025, 12:43 PM
    I'm working on my first library (its an android library). It's definitely been a bit of a journey to get it "production" ready. on of my release readiness steps is trying to comb over all of my dependencies and whether or not they should be defined as api vs implementation. are their any hard/fast rules regarding api vs impl. should i just make every dep api?
    j
    o
    +5
    • 8
    • 26
  • m

    Matt Nelson

    10/11/2025, 5:55 PM
    Anyone know if I have an inline function with a
    contract
    defined, and another
    inline
    function points to it, do I also have to specify the
    contract
    in that inline function? E.g. Does
    foo
    also need the
    contract
    defined?
    Copy code
    public inline fun foo(block: () -> Unit): Boolean = bar(block)
    
    @OptIn(ExperimentalContracts::class)
    public inline fun bar(block: () -> Unit): Boolean {
        contract { callsInPlace(block, InvocationKind.AT_MOST_ONCE) }
        // ...
    }
    d
    • 2
    • 2
  • c

    Colton Idle

    10/13/2025, 1:42 PM
    Hello, library author noob here. I'm prepping to release my first library (an android library to be exact) and since it's my first time, I'm looking for any advice in the form of a pre-release checklist. Similar to how android has a checklist for apps https://developer.android.com/studio/publish/preparing I was wondering if anyone has a checklist handy for publishing a library. Here's the list that I've put together so far: 1. Create dokka docs and ship with the library 2. Go over your public API in your classes 3. Go over your dependencies to make sure you don't pollute consumers classpath 4. Proguard? (is that a thing for lib development) 5. Anything else?
    m
    c
    +2
    • 5
    • 41
  • c

    Colton Idle

    10/18/2025, 6:53 PM
    Poll: Do you proguard your library before distribution?
    👌 1
    no red 15
    m
    e
    • 3
    • 9
  • m

    Matt Nelson

    10/19/2025, 7:00 PM
    https://kotlinlang.slack.com/archives/C2YH04E3S/p1760899066613969
    e
    • 2
    • 2
  • m

    Matt Nelson

    10/23/2025, 12:02 AM
    If I change a class from
    public final class MyClass(something: Any)
    to
    public open class MyClass(something: Any)
    , will that break backward compatibility?
    🚫 1
    a
    d
    • 3
    • 8
  • c

    Colton Idle

    10/25/2025, 2:50 AM
    When you're building a library (non android library) and you want to include values in the build at compile time, what's the "goto" way to do that? Is it just a properties file or env vars? Basically... im a long time android dev (just getting into library dev) and I'm used to using
    BuildConfig
    to insert api keys and other values into my build to be able to access programatically. But in a plain' ol kotlin/java library there is no BuildConfig. I have seen some other libraries or plugins that attempt to be BuildConfig but in the regular library world but that just seems... off?
    e
    m
    e
    • 4
    • 22
  • c

    Colton Idle

    10/29/2025, 4:51 AM
    Just learned about explicit api mode. Seems like a no brainer for every library to enable that flag. Am I wrong in thinking that? Do you enable explicitApi mode?
    no red 5
    👌 18
    h
    m
    +6
    • 9
    • 24
  • a

    Alex Styl

    11/10/2025, 1:27 PM
    Is there an issue with maven central today? trying to publish a package and getting
    Copy code
    Failed to process request: No objects found in the repository`
    Was able to publish yesterday without an issue
    • 1
    • 1
  • a

    Alex Styl

    11/17/2025, 2:40 PM
    I am still getting the same error via Github actions when publishing my KMP library and I cannot figure this out. I was able to publish this morning but I got the same error in the evening. Any ideas?
    Copy code
    > Failed to close staging repository, server at <https://ossrh-staging-api.central.sonatype.com/service/local/> responded with status code 400, body: Failed to process request: No objects found in the repository
    m
    c
    +3
    • 6
    • 36
  • a

    Alex Styl

    11/19/2025, 10:11 AM
    Switched to vanniktech plugin for publishing. You can see the commit by clicking here. The API changed recently and they havent updated the documentation, so took a lot of time to figure out what was going on. On the bright side it seems very fast and the random error on Github Actions I posted about the other days seems to be fixed
    🎉 5
    🙌 1
    a
    • 2
    • 1
  • m

    mbonnin

    11/21/2025, 1:32 PM
    Heads up you may now request early access to scarf.sh to get back download stats using the Central Portal
    thank you color 4
    r
    c
    • 3
    • 9
  • b

    Bao Le Duc

    11/21/2025, 4:44 PM
    Looking for feedback: https://github.com/baole/diff-kotlin/ A KMP library to implement Myers Diff algorithm
    r
    • 2
    • 2
  • c

    CLOVIS

    11/24/2025, 8:00 AM
    Have you tried publishing a multiplatform libraries and you noticed that your users don't get your
    src/xxxMain/resources
    ? The Kotlin Resources plugins bundle your multiplatform static files into the published artifacts so your users can access them. New documentation site! • #C078Z1QRHL3
    k
    • 2
    • 7
  • c

    Colton Idle

    11/24/2025, 7:19 PM
    Question about how jvm level works with library development (in this case an android library) I have my android library setup as JVM_17 and the library includes a dependency on a library that requires a bump to jvm 21. So I made the bump to 21. Does this mean consuming apps will need a bump to jvm 21? I of course tried it myself, and my sample app compiled without issues. So anyway just trying to sanity check if I should be expecting issues (maybe id get runtime issues and not compile time?)
    h
    m
    • 3
    • 45
  • m

    Matt Nelson

    12/01/2025, 4:33 PM
    Need some API advice. I've added
    UTF-8
    encoding/decoding to a library of mine. I have 2 replacement strategies for invalid sequences available from
    commonMain
    , and am wondering which I should use for the default.
    Copy code
    class UTF8: EncoderDecoder {
    
        class ReplacementStrategy private constructor {
            companion object {
                // Encodes/decodes UTF-8 the same way Kotlin/JVM does.
                val U_003F // ...
    
                // Encodes/decodes UTF-8 the same way Kotlin Js/WasmJs/Wasi/Native does.
                val U_FFFD // ...
    
                // Initalizes to U_003F on Jvm, and U_FFFD on all other platforms.
                val KOTLIN // ...
    
                // Throw on invalid sequences
                val THROW // ...
            }
        }
    }
    The current default that I am using is
    UTF8.ReplacementStrategy.KOTLIN
    , but wondering if that is the best choice before publishing this feature release. Kotlin's
    String.decodeToByteArray()
    and
    ByteArray.encodeToString()
    implementations are different on non-JVM platforms than JVM, producing different results; the above pseudo-code outlines that. Context:
    okio
    and
    kotlinx-io
    UTF-8 implementations are the equivalent of
    UTF8.ReplacementStrategy.U_003F
    Thoughts?
    c
    • 2
    • 2
  • e

    eygraber

    12/03/2025, 2:47 AM
    Anyone noticing an increase in 429 errors when publishing SNAPSHOT versions of KMP libraries?
    👌 1
    h
    m
    • 3
    • 2