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
  • t

    Tiago Nunes

    05/06/2021, 10:11 AM
    In Retrofit we used a custom CallAdapter to wrap every response or error in a NetworkResponse sealed class, instead of relying on exceptions, after reading https://elizarov.medium.com/kotlin-and-exceptions-8062f589d07 by @elizarov. But in Ktor, every example of error handling (including in the documentation https://ktor.io/docs/response-validation.html#expect-success) uses Exceptions instead of Sealed classes. Should we catch the waves and throw ourselves back to exception handling or should we try to implement our own feature to wrap responses in a sealed class?
    k
    j
    +2
    • 5
    • 20
  • a

    Andyeshiet

    05/06/2021, 11:59 AM
    hey guys, here again. After setting up cocoapods and using the workaround around my build configuration i got the app to build. But now the ios APP is crashing on runtime.
    runtime assert: runtime injected twice
    r
    • 2
    • 2
  • e

    edwinRNDR

    05/06/2021, 9:19 PM
    I have a multi module project in which some submodules are mpp and some are jvm only (with the classic non-mpp project layout). I noticed that the jvm submodules are not published by
    publishJvmPublicationToMavenLocal
    . I suspect this behavior is introduced in Kotlin 1.5.0. How do I get the jvm modules to publish, or is turning all submodules into mpp a better option?
    r
    b
    j
    • 4
    • 5
  • a

    adjorno

    05/07/2021, 7:29 AM
    Hi! I am trying to share crypto protocols between android app and server side, for that purpose my app has the following structure: Android app -> jvm library (crypto protocols) -> multiplatform library (android and jvm implementations of platform specific cryptoprimitives) When I build the app in the release mode I am facing the following error:
    The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release'. However we cannot choose between the following variants of security:multiplatform:1.0.0:
              - jvmApiElements-published
              - jvmRuntimeElements-published
              - releaseApiElements-published
              - releaseRuntimeElements-published
              - Variant 'releaseApiElements-published' capability security:multiplatform:1.0.0 declares an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release':
                  - Unmatched attributes:
                      - Provides attribute 'com.android.build.api.attributes.VariantAttr' with value 'release' but the consumer didn't ask for it
                      - Provides release status but the consumer didn't ask for it
                      - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
    I would expect that Gradle would request for androidJvm platform so the dependency can be resolved. But it states that “consumer did not ask for it”. Does anybody know what is the issue and how to solve it.
    t
    • 2
    • 2
  • a

    Arkangel

    05/07/2021, 11:53 AM
    hey guys anyone got a solution around https://dl.bintray.com/xorum-io/ReKamp
    r
    • 2
    • 1
  • t

    Tiago Nunes

    05/07/2021, 12:30 PM
    Hi everyone, has anyone met this problem with firebase-kotlin-sdk by GitLiveApp?
    Firebase.firestore.collection("rocketLaunches").add(sampleLaunch)
    this line gives this build error:
    e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong bytecode generated
      @Lorg/jetbrains/annotations/Nullable;() // invisible
      // annotable parameter count: 1 (visible)
      // annotable parameter count: 1 (invisible)
      @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 0
    • 1
    • 1
  • a

    Animesh Sahu

    05/07/2021, 1:10 PM
    Any standard method to sleep in K/MP? (without library - coroutines)
    🇳🇴 1
    a
    • 2
    • 2
  • r

    ribesg

    05/07/2021, 2:44 PM
    Did somebody find the workaround for this new warning that appears after updating some dependencies in a KMP project? I think maybe it comes from Gradle 7.0 but I’m not sure.
    The Kotlin source set androidAndroidTestRelease was configured but not added to any Kotlin compilation. You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
    See <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets>
    👀 2
    j
    n
    • 3
    • 2
  • k

    krzysztof

    05/07/2021, 3:18 PM
    Does anyone know how to properly override Obj-C delegate, where some its
    open
    functions have the same signature?
    r
    • 2
    • 7
  • j

    Jawid

    05/07/2021, 3:53 PM
    Does anyone know how to fix
    The feature "multi platform projects" is experimental and should be enabled explicitly
    warning in IntelliJ IDEA (Android Studio)? Thanks
    t
    • 2
    • 4
  • x

    xxfast

    05/08/2021, 2:36 AM
    is there a nicer way to invoke kotlin data class copy constructor from swift without having to pass in every argument?
    a
    • 2
    • 1
  • k

    Kieran Macdonald Hall

    05/08/2021, 10:24 AM
    Hello all, Is there any plans for a kotlin multiplatform crypto lib? I'm looking for the obvious SHA256, Bech32, Base58 etc... perhaps as part of standard library.
    r
    • 2
    • 4
  • a

    Animesh Sahu

    05/09/2021, 6:32 AM
    How to add cinterop to a common module like for example linux common module?
    val linuxSettings: org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget.() -> Unit = {
            val main by compilations.getting
    
            main.cinterops.create("x11") { defFile("src/linuxCommonMain/cinterop/cinterop.def") }
        }
        linuxX64(configure = linuxSettings)
        linuxArm64(configure = linuxSettings)
        linuxArm32Hfp(configure = linuxSettings)
    Does not work 🤐 The package is inaccessible from
    val linuxCommonMain by sourceSets.creating { dependsOn(commonMain) }  <<----
    val linuxX64Main by sourceSets.getting { dependsOn(linuxCommonMain) }
    val linuxArm64Main by sourceSets.getting { dependsOn(linuxCommonMain) }
    val linuxArm32HfpMain by sourceSets.getting { dependsOn(linuxCommonMain) }
    I do have
    kotlin.mpp.enableGranularSourceSetsMetadata=true
    kotlin.native.enableDependencyPropagation=false
    in gradle.properites, and platform.posix works, so I guess cinterop should've been considered 🤔 But its not :blob-thinking-upside-down:
    m
    • 2
    • 13
  • a

    Andyeshiet

    05/09/2021, 10:11 AM
    • 1
    • 2
  • w

    Wolfgang

    05/09/2021, 1:20 PM
    Module not found: Error: Can't resolve 'kotlinx-serialization-kotlinx-serialization-core-jsLegacy' in kotlin-dce-dev
    someone knows a solution for this?
    j
    • 2
    • 4
  • b

    bod

    05/09/2021, 3:04 PM
    Hello, World! Any idea why, on a multiplatform project, when using
    plugins { kotlin("multiplatform") version "1.5.0"
    , I'm getting
    The feature "sealed interfaces" is only available since language version 1.5
    ?
    • 1
    • 1
  • m

    Michal Klimczak

    05/09/2021, 8:49 PM
    what's the good practice for kotlin multiplatform libraries? let's say my lib only serves purpose for ios targets, but it has some annotations which will be used in
    commonMain
    module. I want to be a good citizen and not break android or js targets for people using this lib - do I need to provide a no-op js target as well for compatibility (at least for the target that's gonna be used in
    commonMain
    )? Or is there some magic that should work it out automatically?
    • 1
    • 1
  • m

    maarten ha

    05/10/2021, 11:33 AM
    Hi, I’m new to kotlin and especially to multiplatform, but I am trying to work on an kmm project and would like to use a D-KMP architecture. The issue is I’m a student that started coding 2 years ago and have mostly worked on web development. We’ve done a little react native app but nothing with native programming. I was hoping someone could help me with understanding how the architecture works (practical not theoretical). And if this would be a goed way to learn kotlin / mobile development / desktop / (web) as multiplatform.
    s
    r
    • 3
    • 4
  • m

    mboudraa

    05/10/2021, 6:34 PM
    I’ve been at this for the past 2 days upgrading dependencies forcing dependency versions to be compatible with kotlin 1.5.0 but nothing seems to work. What am I missing?
    s
    • 2
    • 1
  • n

    Napa Ram

    05/11/2021, 6:23 AM
    Hello everyone, can anyone explain why do we need to add library separately in androidMain and iosMain and then commonMain, can't we add at once in commonMain and use it for ios and android both
    j
    • 2
    • 11
  • p

    Paul Woitaschek

    05/11/2021, 10:27 AM
    Did someone manage to exclude kotlin native compilations from the maven publish task? We publish the ios classes as an xcframework and the jvm classes to our internal maven repo. However on macs the publish task takes ages because all the klibs are being built that we don't need
    b
    t
    • 3
    • 2
  • b

    Berkan

    05/11/2021, 1:54 PM
    Where can i find the KMM open source project?
    b
    e
    +2
    • 5
    • 6
  • a

    Akshat Sharma

    05/12/2021, 12:02 AM
    Did anyone managed to created the KMM project in android studio on Mac? Tried to follow the youtube video exactly, however, the android studio doesnt show me Android Module, iOS breaks… Any sort of help is appreciated
    m
    l
    • 3
    • 5
  • a

    Arjan van Wieringen

    05/12/2021, 8:41 AM
    I have a strange issue where the development server for JS doesn't start in --continuous mode. Yesterday it worked, today it doesn't. I am running 1.5.0 and Gradle 7.0.1. Any idea what can be the cause? I also cleaned build and invalidated caches, but to no avail.
    Screen Recording 2021-05-12 at 10.38.54.mp4
    b
    • 2
    • 22
  • a

    Akshat Sharma

    05/12/2021, 8:57 AM
    Did anyone managed to create the multiplatform project in android studio on Mac? Tried to follow the youtube video exactly, however, the android studio doesnt show me Android Module, iOS breaks… Any sort of help is appreciated
    a
    • 2
    • 1
  • m

    Mike

    05/12/2021, 12:09 PM
    Was the KN memory model changed again in 1.5? I’m getting a lot of freeze errors on iOS after updating. Spent all afternoon debugging it.
    t
    a
    • 3
    • 7
  • s

    sendoav

    05/12/2021, 3:35 PM
    Hi all, I'm creating a single iOS Framework from an umbrella multiplatform module which contains 4 modules. The operation takes 4 minutes approximately. Is there any optimization I could try to lower the generation time? Could the increase of the number of submodules within the umbrella module affect positively?
    k
    s
    • 3
    • 13
  • s

    Slackbot

    05/12/2021, 7:32 PM
    This message was deleted.
    j
    • 2
    • 1
  • j

    Jeff Tycz

    05/13/2021, 1:15 AM
    Whenever I try to run a build for my KMM module I keeps trying to run tests and just sits there forever. I dont have any tests to run so I dont know what its doing, as you can see from the screen shot the build task was running for 20 mins until I stopped it. Is there a way to not run tests when building?
    k
    • 2
    • 1
  • r

    Rémy

    05/13/2021, 5:17 PM
    Hi everyone, I tried since yesterday to make a Kotlin Multiplatorm project who share Android / iOS / Desktop. The project build without problem just with Android / iOS platform, but since I try to implement desktop with Jetbrains Compose I have this error (in thread).
    :thread-please: 1
    r
    • 2
    • 4
Powered by Linen
Title
r

Rémy

05/13/2021, 5:17 PM
Hi everyone, I tried since yesterday to make a Kotlin Multiplatorm project who share Android / iOS / Desktop. The project build without problem just with Android / iOS platform, but since I try to implement desktop with Jetbrains Compose I have this error (in thread).
:thread-please: 1
Execution failed for task ':shared:cinteropAFNetworkingIos'.
> Could not resolve all files for configuration ':shared:iosAFNetworkingCInterop'.
   > Could not find runtime-0.4.0-build188-samplessources.jar (org.jetbrains.compose.runtime:runtime:0.4.0-build188).
     Searched in the following locations:
         <https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/compose/runtime/runtime/0.4.0-build188/runtime-0.4.0-build188-samplessources.jar>
   > Could not find foundation-0.4.0-build188-samplessources.jar (org.jetbrains.compose.foundation:foundation:0.4.0-build188).
     Searched in the following locations:
         <https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/compose/foundation/foundation/0.4.0-build188/foundation-0.4.0-build188-samplessources.jar>
   > Could not find material-0.4.0-build188-samplessources.jar (org.jetbrains.compose.material:material:0.4.0-build188).
     Searched in the following locations:
         <https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/compose/material/material/0.4.0-build188/material-0.4.0-build188-samplessources.jar>

Possible solution:
 - Declare repository providing the artifact, see the documentation at <https://docs.gradle.org/current/userguide/declaring_repositories.html>
I see that following location to download dependencies add a
-samplessources
... Do you have an idea please 🤔 ?
r

russhwolf

05/13/2021, 5:38 PM
It has to do with a dependency not resolving, for example if you're trying to use a dependency in common that wasn't build for one of the platforms you're using. See https://youtrack.jetbrains.com/issue/KTIJ-10769
r

Rémy

05/13/2021, 5:43 PM
I didn’t understand the problem in this way 😮 I remove these dependencies from `commonMain`:
api(compose.runtime)
                api(compose.foundation)
                api(compose.material)
And the build works! Thank you @russhwolf
r

russhwolf

05/13/2021, 5:43 PM
yeah it's a confusing error message. There's another ticket linked in there about updating the error to be more clear
🙂 1
View count: 8