https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
multiplatform
  • r

    Rahul Rawat

    01/14/2022, 4:40 PM
    I am trying to build an aar from a KMP library I just created but running PublishToMavenLocal seems to be creating two aar’s debug and release with size in some 100 kbs which doesn’t seem right. Both of them are in build/outputs/aar folder. Please can anyone help me with what I may be doing wrong. Attached is my build.gradle file
    build.gradle.kts
    a
    • 2
    • 6
  • a

    AnaR

    01/14/2022, 5:47 PM
    Any recommendations for KMM libraries to use for Mocking for tests? I've found MMock from Pega Systems and Karmok from Touchlab so far, but haven't tried them yet. Please also share thoughts if you've tried either of them.
    k
    g
    +2
    • 5
    • 9
  • r

    Rahul Rawat

    01/15/2022, 1:19 PM
    I am having an issue with my multiplatform library where I build an aar which is resolving correctly but it’s dependecies are not being resolved. Is there any way to transitively add depedencies while using implementation with a aar file inside the libs folder in android?
    b
    • 2
    • 22
  • a

    aarjav

    01/15/2022, 6:31 PM
    Hi, I want to create a multiplatform cache utility similar to caffeine and
    LoadingCache
    of guava. I am fairly familiar with kotlin jvm, however haven't used kotlin on other platforms yet. Is it okay to jump into multiplatform directly? If not, is there some roadmap I can follow? I have started to write the common api, but I am not sure what to use in place of
    ConcurrentMap
    , Do I make my own map interface? What would be the actual in kotlin native?
    j
    u
    • 3
    • 4
  • j

    Javier

    01/15/2022, 11:50 PM
    Is it possible to update all versions to the latest one in the
    kotlin-js-store/yarn.lock
    ?
    j
    r
    • 3
    • 5
  • r

    Rita Okonkwo

    01/16/2022, 6:22 PM
    Hello everyone! Please when working with KMM, how are secrets hidden? Secrets like API keys? Tried the buildconfig option but for some strange reasons, I can't use that in my shared module.
    j
    m
    n
    • 4
    • 10
  • s

    salomonbrys

    01/17/2022, 1:36 PM
    Hey guys. A few weeks ago, I introduced Micro-Mock, a mocking processor & runtime for Kotlin Multiplatform that allows to mock interfaces with the same syntax & semantics than MockK or Mockito-Kotlin. Today I'm announcing that it has been renamed MocKMP and promoted to stable. Here is the announcement article: https://medium.com/kodein-koders/mockmp-a-mocking-processor-for-kotlin-multiplatform-51957c484fe5 The library itself lives here: https://github.com/Kodein-Framework/MocKMP We hope you'll find it usefull.
    👍 6
    🥳 5
    :kotlin-intensifies-purple: 14
    🙌 5
    p
    a
    a
    • 4
    • 22
  • m

    Milan Vadhel

    01/18/2022, 4:44 AM
    Hello Everyone, What if i want to integrate GraphQL in KMM? Is there anything specific like Ktor?
    i
    t
    y
    • 4
    • 5
  • e

    Evgenii Sokol

    01/18/2022, 5:53 PM
    Hello! Did anyone implemented unit-tests with real endpoints and with out mocks in KMM?
    t
    • 2
    • 6
  • l

    Landry Norris

    01/18/2022, 7:49 PM
    What causes tests to get skipped when running allTests or check? My linuxX64 and macosArm64 tests are always skipped. I am currently running on a mac.
    c
    a
    • 3
    • 4
  • m

    martmists

    01/19/2022, 3:17 PM
    plugins {
        kotlin("multiplatform")
        kotlin("plugin.serialization")
    }
    
    kotlin {
        js(IR) {
            browser()
        }
        jvm()
    
        sourceSets {
            val commonMain by getting {
                dependencies {
                    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
                    implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.2")
                }
            }
        }
    }
    
    group = "com.martmists"
    version = "1.0"
    Why is the code in this submodule saying serialization and datetime don't exist when I try to compile it, but only for compileKotlinJs?
    m
    • 2
    • 7
  • j

    Johannes Fahrenkrug

    01/19/2022, 5:30 PM
    Hello! I’m new here 🙂 I have a quick question about the timing for the upcoming 1.6.20 release. I use Kotlin Multiplatform and I’m currently using a -dev version of 1.6.20 because of the excellent new support for XCFrameworks in connection with CocoaPods. Is the final release of 1.6.20 “around the corner” or a long while off? Thanks!!
    v
    h
    p
    • 4
    • 11
  • t

    Travis Reitter

    01/19/2022, 6:00 PM
    hi, I'm trying to migrate to
    embedAndSignAppleFrameworkForXcode
    and followed the steps here but am getting:
    Task 'embedAndSignAppleFrameworkForXcode' not found in project ':SharedCode'
    n
    r
    • 3
    • 14
  • t

    Travis Reitter

    01/19/2022, 10:48 PM
    I just switched to
    embedAndSignAppleFrameworkForXcode
    to build my iOS app (Kotlin 1.6.10, M1 Mac, Xcode 13.2.1) and I hit this crash at runtime which seems to indicate a linking error but I'm not sure why since I include this in my Frameworks search paths:
    $(SRCROOT)/../SharedCode/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)
    The error is:
    dyld[28834]: Library not loaded: @rpath/SharedCode.framework/SharedCode
      Referenced from: /Users/treitter/Library/Developer/CoreSimulator/Devices/A5638492-9E3A-4766-B4D4-6827DF4DBAC8/data/Containers/Bundle/Application/CADE4DEF-489A-4E7F-B600-8CFAA803F19D/DoubleStrain <http://dev.app/DoubleStrain|dev.app/DoubleStrain> dev
      Reason: tried: '/Users/treitter/Library/Developer/Xcode/DerivedData/DoubleStrain-csfvqjqyopvjufbkvgenmyhjexpz/Build/Products/Debug-iphonesimulator/SharedCode.framework/SharedCode' (no such file), '/Users/treitter/Library/Developer/Xcode/DerivedData/DoubleStrain-csfvqjqyopvjufbkvgenmyhjexpz/Build/Products/Debug-iphonesimulator/PackageFrameworks/SharedCode.framework/SharedCode' (no such file),
    ...
    it continues on with many more directories it checked but none of them match the pattern above. None even include
    xcode-frameworks
    in the path. Any ideas for debugging?
    d
    • 2
    • 4
  • p

    Pavel Repkin

    01/20/2022, 7:53 AM
    Hi, guys! I wonder if KMM can be used with multiplatform template in XCode to build an app for both iOS and Mac? Or is it just iOS only?
    p
    • 2
    • 2
  • n

    Neal Sanche

    01/20/2022, 4:33 PM
    Why is this happening to me? I uninstall the plugin and reinstall it and it keeps telling me there is an update available, and then when I update it says it can't:
    a
    • 2
    • 5
  • n

    Neal Sanche

    01/20/2022, 5:04 PM
    Another question: We have some class names in different packages in our KMM library that are the same, and on iOS these appear with underscores after them. For example, we have a GraphQL generated class called MonetaryValue. We thought we would hide these by making domain classes, in a 'models' package, with the same name, and just do some straight copying of the GraphQL classes into these. KMM seems to be taking the duplicate names and adding underscores. So we have
    MonetaryValue
    which is the GraphQL class.
    MonetaryValue_
    which seems to be the data class we want. But then there's also a
    MonetaryValue__
    which is an
    @interface
    that has a bunch of swift attributes like
    component1()
    and
    component2()
    and properties for the actual interesting data class things. Is the way all of this works documented somewhere? Or can someone explain this? Is there a way to change this behaviour? Thanks for any and all insights.
    k
    a
    a
    • 4
    • 7
  • g

    georgi

    01/21/2022, 4:39 PM
    👋 Hey everyone! I'm playing with a multi-module KMM project and I've noticed the following behaviour: If one KMM module (
    A
    ) declares a dependency on another KMM module (
    B
    ), the generated Swift code will prefix the classes from
    B
    with its fully qualified module name when they are exposed through
    A
    . For example, a class
    MyClass
    defined in
    B
    but exposed through
    A
    will be available as
    BMyClass
    when the
    A.framework
    is used in Swift through
    embedAndSignAppleFrameworkForXcode
    . This is an issue when I have an interface which is defined in one module but implemented in another in which case Swift is not able to match the class names and does not consider the implementation as a valid argument when it is being passed as a parameter for example. Any ideas about this? Thanks in advance!
    ✅ 1
    t
    k
    +2
    • 5
    • 27
  • b

    bendb

    01/21/2022, 5:48 PM
    Hey folks. Maybe this is a basic question, but I am stumped. I have a multiplatform library as part of a multiproject Gradle setup; it currently just has common and JVM builds. When I add
    kotlin {
      ...
      ios {
        binaries.framework()
      }
    }
    I get a strange dependency-resolution failure:
    Could not find :kotlin-native-prebuilt-macos-x86_64:1.6.10
    . I've already got the multiplatform plugin applied, the build has been working, etc. Is there perhaps some obvious dependency I'm missing? If not, any suggestions on how I could debug this?
    😒olved: 1
    • 1
    • 1
  • e

    Eamon Keane

    01/21/2022, 6:16 PM
    We've got an established fairly large android app that we're now going to port to iOS (structured with KMM in mind). I have it set up with the Android Studio KMM project template and working with
    cocoapods
    and
    xcode-build
    in bitrise. Given we have no iOS experience, what would be the best workflow, I'm thinking AppCode for the non-UI swift stuff, and Xcode for just the UI? Separately, it would be nice to use AppCode's project structure but it doesn't look like it's ready for primetime. For example, it still seems to be on Kotlin
    1.5.10
    , and only defines the xcode project in gradle dsl which xcode can't open. How easy would it be to potentially use this gradle dsl definition and create the xcode project scaffold separately so xcode can open it?
    k
    • 2
    • 1
  • c

    Claude Brisson

    01/21/2022, 8:48 PM
    I tracked down my problem from earlier to this: When an actualization of an expected class is a typealias, the compiler generates the Kt class but not the class itself. Example: In the multiplatform library:
    // commonMain file Expectations.kt
    package foo
    expect class SQLException
    
    // jvmMain file SQLException.kt
    package foo
    actual typealias SQLException = java.sql.Exception
    The -jvm.jar contains SQLExceptionKt.class, but no SQLException.class. In a JVM consumer library, the type foo.SQLException is unknown. Of course, there's the workaround to always use java.sql.SQLException in the JVM, but if the consumer library wants to implement an interface with @Throws(foo.SQLException::class), it's not possible.
    i
    • 2
    • 3
  • f

    Fredrick Eisele

    01/21/2022, 9:14 PM
    Guidance in Porting Apache project TinkerPop from Java to Kotlin MultiPlatform.
    k
    m
    • 3
    • 10
  • p

    ptsiogas

    01/22/2022, 7:17 AM
    Hi there, has anyone tried to create a KMM module and publish it as a native Android library on maven? My understanding is that this is not possible because of the transitive dependencies that may exists in KMM module. I would like to hear your thoughts.
    p
    b
    • 3
    • 9
  • j

    Javier

    01/22/2022, 1:01 PM
    Because latest Kotlin version only needs macOS to publish all targets, this setup is necessary anymore if we are using only macOS for publishing? https://kotlinlang.org/docs/mpp-publish-lib.html#avoid-duplicate-publications
    a
    • 2
    • 1
  • r

    raulraja

    01/22/2022, 1:18 PM
    Hi everyone, I was wondering if there are any plans or what the status of maven support is for KMP. I have noticed many libraries and gradle plugins include their own version of https://github.com/Him188/maven-central-publish/blob/0a7ea56328181adc539b10f392604[…]im188/maven/central/publish/gradle/MavenCentralPublishPlugin.kt
    publishPlatformArtifactsInRootModule
    in order to provide support for KMP artifacts from maven. Currently we are having issues in Arrow and wondering if this is needed or if there is a better way to solve it. Thanks!
    j
    • 2
    • 1
  • k

    Kaushalya

    01/23/2022, 4:28 PM
    What are your favourite KMM libaries other than SQLDelight?
    b
    p
    +6
    • 9
    • 18
  • y

    ynsok

    01/23/2022, 4:52 PM
    Hi, I want to create KMP project for Android and Desktop, and I Would like to have every feature in different module (modular app). Any suggestions how can I achive it?
    b
    • 2
    • 1
  • z

    Zahara Vidumshikova

    01/24/2022, 12:21 PM
    Is there a way to use Gradle modules instead of targets?
    b
    j
    • 3
    • 8
  • a

    Akram Bensalem

    01/24/2022, 9:18 PM
    r
    • 2
    • 2
  • m

    Marko Novakovic

    01/24/2022, 10:22 PM
    KMM project in Android Studio shows
    androidTest
    everywhere. I can't find
    commonTest
    . when I change project view to
    Project
    I can see
    commonTest
    but when I want to run tests am given options:
    android:(testDebugUnitTest)
    and
    android:(testReleaseUnitTest)
    . how to run common tests as plain JVM Kotlin tests?
    e
    l
    • 3
    • 7
Powered by Linen
Title
m

Marko Novakovic

01/24/2022, 10:22 PM
KMM project in Android Studio shows
androidTest
everywhere. I can't find
commonTest
. when I change project view to
Project
I can see
commonTest
but when I want to run tests am given options:
android:(testDebugUnitTest)
and
android:(testReleaseUnitTest)
. how to run common tests as plain JVM Kotlin tests?
e

ephemient

01/24/2022, 10:28 PM
testDebugUnitTest and testReleaseUnitTest are local JVM tests. the device instrumentation tests end up in androidAndroidTest with KMM
m

Marko Novakovic

01/24/2022, 10:39 PM
why then are they prefixed with
android:
? that's what confuses me
e

ephemient

01/24/2022, 10:41 PM
they're built for the android target (and will run with a stub android framework). if you had a jvm target, that would show up separately
m

Marko Novakovic

01/24/2022, 10:54 PM
how to write and run plain Kotlin tests?
l

loke

01/25/2022, 8:13 AM
@Marko Novakovic the tests always has to run in something. So you run the test for the specific platform, which includes all the common tests.
In my project I have about 1200 tests, most of them in common. When I run the JVM, Native and JS tests, I end up running over 3000 tests because all the common tests run multiple times. This is what you want, because you need to make sure that your common code works on all platforms.
m

Marko Novakovic

01/25/2022, 9:05 AM
I see. now it makes sense. thanks!
View count: 4