https://kotlinlang.org logo
Docs
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
  • a

    Ashish Kumar Joy

    03/11/2021, 1:50 PM
    Hi all, Is there any specific configuration required to run js test when we use IR backend. Before using IR backend for js target my js test were running but after switching to IR non of the js test are running. Here is my build gradle file: https://github.com/ashishkujoy/kotlin-js-jvm-library/blob/main/build.gradle.kts Thanks
    j
    • 2
    • 16
  • u

    uli

    03/11/2021, 10:51 PM
    Hi all, is it possible to call a kotlin function from swift that expects a suspend lambda parameter? i.e. in kotlin you can pass non-suspending functions where suspending ones are expected. Seems this is not possible from swift and we can not write suspend swift blocks ;-)
    e
    • 2
    • 6
  • y

    Yaniv Sosnovsky

    03/14/2021, 12:32 PM
    Hi guys. I’m trying to include dev.gitlive:firebase-firestore into my kmm project and it works fine until I try to run unit tests on iOS. Whenever I try to run the unit tests I get this error: The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1. output: ld: framework not found FirebaseFirestore FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘😒hared:linkDebugTestIosX64’. Has anyone seen this before?
    t
    • 2
    • 7
  • g

    Goku

    03/14/2021, 11:13 PM
    Is there a way to retry requests with Ktor ? I’ve tried using HttpSend feature, but wasn’t able to get the request to retry 😞
    t
    • 2
    • 2
  • n

    Nick

    03/15/2021, 1:21 AM
    Is it possible to exclude jsTest target from a MPP library? I have my tests in commonTest and would like to use jvmTest as the only target. But jsTest is included by default. This is an issue because the mock library I use does not have a JS (IR) version.
    t
    m
    r
    • 4
    • 7
  • d

    Davin reinaldo gozali

    03/15/2021, 3:01 AM
    Hi all, I want to ask related to Cinterop code that produce function like this :
    fun myFunction(param1 : String, error : error : CPointer<ObjCObjectVar<NSError?>>?)
    how to user that kind of CPointer type ?
    a
    • 2
    • 2
  • s

    sushma nayak

    03/16/2021, 10:31 AM
    I see that
    xcodebuild
    command is picking the
    xcodeproj
    instead of workspace.
    a
    • 2
    • 2
  • s

    sushma nayak

    03/16/2021, 12:50 PM
    Suggestions needed for linter for KMM module.
    a
    • 2
    • 2
  • n

    Nicholas Tian

    03/17/2021, 12:23 AM
    Hi there, I would like to create a static lib from my KMM project (into my Swift framework project), any recommended best practice? I have built a static library from my KMM project but the generated header is more geared towards C rather than Objective-C or Swift. The dynamic framework generated from the KMM project has the correct/Swift-y header I'd like to have. Any idea how can I combine the best of these two worlds?
    a
    • 2
    • 6
  • a

    Andrew Steinmetz

    03/17/2021, 6:19 AM
    Hello, I was trying to create a kotlin multiplatform library that could be used from any ios, macos, android, jvm, and js target. When I tried to implement the kotlin native part for iOS I was struggling to get the cocoapods to resolve in the
    iosMain
    folder. However I could get them to resolve if I created a folder for each ios architecture ie iosArm64 or 32. Was curious is the expectation to implement the actual implementations for each architecture or was there something I was missing after following this guide to get cocoapods to resolve for ios? https://kotlinlang.org/docs/native-cocoapods.html#add-a-dependency-on-a-pod-library-from-the-cocoapods-repository
    a
    b
    • 3
    • 2
  • m

    Michal Klimczak

    03/17/2021, 8:47 AM
    There is no library for parsing xml on kotlin native ios, right?
    d
    b
    s
    • 4
    • 8
  • k

    kpgalligan

    03/17/2021, 5:54 PM
    Just throwing this out there: https://twitter.com/kpgalligan/status/1372244788037234693?s=20
    👍 1
    💥 2
    i
    • 2
    • 1
  • j

    jean

    03/17/2021, 7:43 PM
    I followed this article to create a swift package of my shared code : https://johnoreilly.dev/posts/kotlinmultiplatform-swift-package/. I managed to import it through github and I can see the dependency (the swift file, the zip folder and the xcframework). But when I make the
    import MyPackage
    statement, xcode complains about
    no such module 'MyPackage'
    . Has anyone encounter this error? Do I need to specify something more than
    multiplatformSwiftPackage {
        packageName("MyPackage")
        swiftToolsVersion("5.3")
        targetPlatforms {
            iOS { v("13") }
        }
    }
    in
    build.gradle.kts
    ?
    j
    • 2
    • 5
  • d

    Davin reinaldo gozali

    03/18/2021, 6:53 AM
    Anyone know how to set proxy for yarn & npm session inside konan ? I have problem when working behind corporate proxy and build my multiplatform project that contain js module. I always get :
    Error: Couldn't find package "karma-webpack@4.0.2" required by "qris-multiplatform-lib-test@1.1.8-rc1" on the "npm" registry.
        at MessageError.ExtendableBuiltin (C:\Users\davin\.gradle\yarn\yarn-v1.15.2\lib\cli.js:721:66)
        at new MessageError (C:\Users\davin\.gradle\yarn\yarn-v1.15.2\lib\cli.js:750:123)
        at PackageRequest.<anonymous> (C:\Users\davin\.gradle\yarn\yarn-v1.15.2\lib\cli.js:35729:17)
        at Generator.throw (<anonymous>)
        at step (C:\Users\davin\.gradle\yarn\yarn-v1.15.2\lib\cli.js:304:30)
        at C:\Users\davin\.gradle\yarn\yarn-v1.15.2\lib\cli.js:317:13
        at process._tickCallback (internal/process/next_tick.js:68:7)
    I'm already try to switch using public connection and work smoothly set proxy to
    C:\Users\<username>\.npmrc
    or
    C:\Users\<username>\.yarnrc
    don't give any effect should I change proxy configuration via gradle DSL ? or is there any solution for these issue ?
    b
    d
    • 3
    • 9
  • j

    Joseph Roffey

    03/18/2021, 12:32 PM
    Hi. there, in the KMM docs I can see that it says:
    Kotlin supports interoperability with Objective-C dependencies and Swift dependencies if their APIs are exported to Objective-C with the 
    @objc
     attribute. Pure Swift dependencies are not yet supported.
    I am hitting an issue trying to depend on a pod (SPPermissions) which I think might be because it is a “Pure Swift” dependency, although I’m not sure I can be certain about that, as this is the first pod I’ve tried to depend on… As it says “Pure Swift dependencies are not yet supported” I was wondering if there is a link to monitor the planned implementation of supporting Pure Swift dependencies, and was wondering if there is a suggested workaround e.g. forking the relevant project and adding in the
    @objc
    exports required or else releasing a delegate project that simply imports the Swift dependency and exposes an Objective C api? I’m by no means an expert on KMM so am worried I might be trying to do something that just can’t work with the current methodology, but I’d be keen to hear any advice anyone might have.
    m
    s
    • 3
    • 11
  • s

    Shabinder Singh

    03/18/2021, 7:24 PM
    SpotiFlyer now targets : Android, Web and Desktop, being a Kotlin Multiplatform Project ,It shares more than 90% Business Logic including things like Navigation etc too! Repo: https://github.com/Shabinder/SpotiFlyer Pull Requests are always welcome, support for web & desktop is still in Beta.
    :kotlin-intensifies: 8
    🆒 6
    😍 5
    c
    m
    • 3
    • 9
  • m

    Muhammed khaled

    03/18/2021, 9:46 PM
    what is the libraries can use in shared module kmm generally !? and can i use apollo lib for graphQl at shared module and how thanks in advanced
    m
    • 2
    • 2
  • k

    Kyant

    03/18/2021, 11:54 PM
    Why IDEA EAP doesn't have Kotlin 1.4.31 plugin but IDEA stable has?
    t
    • 2
    • 1
  • j

    jean

    03/19/2021, 8:50 AM
    I’m trying to get an instance of my sqldelight database on ios, but I haven’t figured it out yet. On android, i do this :
    val factory = DatabaseDriverFactory(context)
    val db = MyDatabase(factory.createDriver())
    return NewsDatabaseClient(db)
    and it works fine. But if I try this on ios:
    let factory = DatabaseDriverFactory()
    let db = MyDatabase(driver: factory.createDriver())
    let client = NewsDatabaseClient(database: db)
    I get the following error
    'MyDatabase' cannot be constructed because it has no accessible initializers
    Does anyone know how I’m suppose to create it?
    y
    • 2
    • 2
  • l

    Lena Brusilovski

    03/19/2021, 6:20 PM
    ios has a method called “deinit” is there a way to invoke it using kotlin code ?
    s
    s
    • 3
    • 5
  • d

    Daniele B

    03/20/2021, 12:34 PM
    I am finally publishing a sample on Github for the D-KMP architecture. These are the characteristics: • it uses the latest declarative UI toolkits: JetpackCompose for Android and SwiftUI for iOS • it fully shares the ViewModel (and the DataLayer) via Kotlin MultiPlatform • it provides 2 types of functions to the UI layer: Event functions and StateProvider functions • it implements the MVI pattern and the unidirectional data flow • it uses Kotlin’s StateFlow for the multi-platform observable mechanism Any feedback is very welcome! https://twitter.com/dbaroncellimob/status/1373267068414529536
    👍 10
    i
    • 2
    • 2
  • l

    Lena Brusilovski

    03/21/2021, 6:05 AM
    i have a lot of expect/actual classes between android and iOS, but very often when i try to run the android, i get duplicate jvm and there is no duplicate. How to fix it besides doing clean?
    j
    • 2
    • 1
  • j

    Joost Klitsie

    03/21/2021, 10:38 AM
    What is the common census on the topic expect/actual vs using interfaces? In my KMP project I do use expect actual, but only where I have to (basically it is a workaround for my props interface, which need to be
    external
    on my JS project and that doesn't fly for the other platforms, so there I expect/actual the interface). All the rest is simply an interface with implementations on different platforms and my dependency injection wiring it up. Are there guidelines for this?
    r
    • 2
    • 1
  • p

    ptsiogas

    03/21/2021, 1:38 PM
    Hi there, Is it possible to use “native.cocoapods” library in order to automatically publish the common code in github as a cocoa pod library? The auto generated podspec sets the source as:
    spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
    This works fine locally but I want to change it to something like:
    spec.source = { :git => 'git@my_path.git', :tag => s.version.to_s}
    P.S Ideally I would like to use 2 repositories (Android + KMM, iOS) and feed the iOS app with a KMM cocoa pod.
    k
    • 2
    • 10
  • b

    Benoît

    03/22/2021, 10:45 AM
    Using Crashlytics with KMP and coroutines, the stack trace is completely lost, there's no way for us to what happened, we only know there was a crash in the
    CoroutineExceptionHandler
    Swift object Has anyone managed to fix this issue?
    m
    b
    • 3
    • 11
  • a

    Archie

    03/22/2021, 10:53 AM
    Hi guys, I dont know if this is the right channel to ask. but im trying to access
    IosClientEngine
    inside
    iosMain
    but I cant seem to find the build function
    Ios
    ? Ive added the dependency
    io.ktor:ktor-client-ios:1.5.2
    . Is there anything I should do? Does anyone have an example of this. Please help. Thanks in advance.
    p
    • 2
    • 2
  • l

    Lena Brusilovski

    03/22/2021, 12:20 PM
    is there a way to do expect/actual for enums?
    d
    c
    • 3
    • 9
  • a

    Andyeshiet

    03/22/2021, 7:00 PM
    implementation platform(‘com.google.firebase:firebase-bom: I am trying to use firebase in my androidMain and can’t find ‘platform’ in the KotlinDependencyHandler block
    m
    • 2
    • 1
  • s

    sushma nayak

    03/22/2021, 9:48 PM
    Is there a ios Decodable equivalent in kotlin? Was trying to achieve a generic api client in kotlin for a kmm project. https://kotlinlang.slack.com/archives/C0A974TJ9/p1616449454066700
    r
    • 2
    • 1
  • t

    Thomas Flad

    03/23/2021, 9:51 AM
    Hi everyone, I have troubles with the setup for sonarqube. As soon I have expect/actual classes in my test packages I got this error from the sonarqube gradle task:
    > Task :common:compileDebugAndroidTestKotlinAndroid FAILED
    e: /common/BaseTest.kt: (5, 23): Expected class 'BaseTest' has no actual declaration in module <common_debug> for JVM
    I’m a little lost because I have no JVM target only Android and iOS.
    k
    m
    • 3
    • 7
Powered by Linen
Title
t

Thomas Flad

03/23/2021, 9:51 AM
Hi everyone, I have troubles with the setup for sonarqube. As soon I have expect/actual classes in my test packages I got this error from the sonarqube gradle task:
> Task :common:compileDebugAndroidTestKotlinAndroid FAILED
e: /common/BaseTest.kt: (5, 23): Expected class 'BaseTest' has no actual declaration in module <common_debug> for JVM
I’m a little lost because I have no JVM target only Android and iOS.
k

Kris Wong

03/23/2021, 1:16 PM
so the task that's producing the error is actually
:common:compileDebugAndroidTestKotlinAndroid
. but you say it succeeds if you're not running the sonarqube task?
t

Thomas Flad

03/24/2021, 6:09 PM
It‘s not succeeds when I run it independently as well. But I don‘t understand yet why this task exists in the first place. @Kris Wong Do you have a running Jacoco/Sonar setup? I saw that you asked a question in direction of Sonarqube compatibility
Currently I just avoid using expect/actual in the test srcsets and it’s working fine but it would be nice to use it for mocking the db connection
k

Kris Wong

03/24/2021, 6:18 PM
i don't have this setup for any of my KMM projects yet
but my point is that it seems unrelated to Sonarqube?
m

magnumrocha

08/24/2021, 11:53 AM
I am having this Issue and I think this is related to the source folder configuration for android unit test (
androidTest)
the gradle plugin doesn’t recognise it as the JVM test folder…
View count: 18