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

    Ola Adolfsson

    09/03/2020, 6:24 PM
    Good evening. maybe a stupid question but… . We’re developing a KMP library targeting JS (web) (and in the future android, etc). The JS target are published as npm packages on our registry. We use the npm-packages in a SPA (not nodeJs) Now to my question, should JS target browser or nodejs? As I understand it, the DCE (threeshaking) is only used by the browser “target”. Using the DCE should result in smaller npm packages? Or?
    a
    • 2
    • 2
  • a

    Alberto

    09/03/2020, 7:19 PM
    hello, I have a project that uses build.gradle (groovy) instead of the kotlin version. I'm trying to translate the fatFramework logic for iOS in groovy but it's taking a long time. Wondering if anyone had a build.gradle to share with that logic already?
    r
    • 2
    • 2
  • v

    Vinod Rai

    09/04/2020, 8:49 AM
    Hey, I'm developing a KMP library targeting iOS & Android. I have included library in Android app as a Jar. Now getting this exception while trying to access the service. java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/serialization/json/JsonKt;
    r
    k
    +2
    • 5
    • 9
  • c

    Christian Sousa

    09/04/2020, 9:17 AM
    Hello everyone, hope this one is easy to answer, I’m trying to create a 
    UITableView
     class, extending both `UITableViewDataSourceProtocol`and 
    UITableViewDelegateProtocol
     , and when overriding methods, I get the following error when running (compiling does not produce any error):
    /Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/cpp/ObjCInterop.cpp:137: runtime assert: Unable to add method to Objective-C class
    I’m not really sure what’s causing the error, I only needed to extend the Delegate for the following method:
    @Suppress("CONFLICTING_OVERLOADS")    
    override fun tableView(tableView: UITableView, viewForHeaderInSection: NSInteger): UIView? {
        return UIView()
    }
    Does anyone knows what I could do? EDIT: Even if I remove the override, the compiler will tell me that: must override public open external fun debugDescription(): String? But when I override it, I get the same error.. (edited) (already tried asking on native channel but got no answer)
    a
    • 2
    • 1
  • u

    4ntoine

    09/04/2020, 10:48 AM
    Hi, all. Being practical my question is “What can be used for files IO in Kotlin Multiplatform at the moment” (let’s say i want to open a text file and get all the lines on both iOS and Android)? I came up with some `expect`ed classes and home-brew 
    actual
     impls using 
    fopen(), ...
     in the 
    native
     sourceSet. Any existing/proper way of doing that? PS. https://github.com/orangy/kotlinx-files seems to be discontinued
    g
    d
    • 3
    • 6
  • s

    Slackbot

    09/04/2020, 2:26 PM
    This message was deleted.
    y
    • 2
    • 3
  • y

    Yevgeni Liskovich

    09/04/2020, 2:30 PM
    👆sorry for two different messages(slack broke into two). but i add more information on first thread. thanks
    b
    • 2
    • 2
  • y

    Yevgeni Liskovich

    09/04/2020, 2:38 PM
    Hi all, I have multi module gradle project(mono repo) for spring boot micro services and their common libraries. I am trying to take one common library(ktor client http wrapper) and migrate it to multiplatform module by changing build.gradle.kts file like this:
    Untitled
    • 1
    • 1
  • m

    manueldidonna

    09/04/2020, 9:49 PM
    I followed the official tutorial to create a mpp library https://kotlinlang.org/docs/tutorials/mpp/multiplatform-library.html How can I import that library into a javascript project?
    n
    • 2
    • 3
  • d

    Daniele B

    09/04/2020, 10:52 PM
    I realized I have a similar feeling of when Google launched Firebase in 2016. At that time I thought: “This is great! finally a suite that unifies Google services for the different platforms! Everything looks so neat and clear! From the same console I can manage the Google services for both the Android and iOS apps!” Now the feeling is: “Wow, finally I can just use Android Studio to configure and build all my apps!” Kotlin MultiPlatform feels like the biggest step forward since Firebase. Not only Google services, but the whole application logic is now multiplatform. The next big step will happen when JetpackCompose will become multiplatform too. It’s probably going to take 2 more years.
    🎉 3
    c
    t
    n
    • 4
    • 10
  • h

    Hadi Lashkari

    09/07/2020, 9:33 AM
    Hi everyone! To enable the hierarchy structure support, I set
    kotlin.mpp.enableGranularSourceSetsMetadata=true
    in
    gradle.properties
    as you can find in https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-similar-platforms, but as a side effect, android source set is not included in the publication! How can I publish for android then? My project is https://github.com/hadilq/log4k/ if it helps. Thanks
    😨 1
    a
    l
    r
    • 4
    • 14
  • n

    natario1

    09/07/2020, 11:04 AM
    Is anyone having issues with the IDE after updating to 1.4.0? Symbols from dependencies are red, even
    platform.*
    imports are red, but code compiles just fine. And the error stays after a clean build / invalidating the cache
    g
    d
    r
    • 4
    • 6
  • m

    Maurice Jouvet

    09/08/2020, 11:50 AM
    Hi, I'm stuck with Koin DI. For explanation I have the same "setup" as this one: https://johnoreilly.dev/posts/kotlinmultiplatform-koin/ But the initialization if failing with:
    Error Domain=KotlinException Code=0 "Could not create instance for [Single:'com.poc.app.kmm.core.interactors.login.getAuthenticationToken.GetAuthenticationTokenUseCase']"
    z
    • 2
    • 2
  • m

    Maurice Jouvet

    09/08/2020, 11:50 AM
    If you have an idea?
    i
    • 2
    • 1
  • w

    william

    09/08/2020, 3:30 PM
    how can i use
    jvm()
    to set a java 8 target?
    a
    • 2
    • 2
  • i

    Ivann Ruiz

    09/08/2020, 5:20 PM
    hi all 👋 currently using Kotlin/Ktor
    1.4.0
    to make a very simple API call on a multiplatform mobile project, however I get
    Thread 1: EXC_BAD_ACCESS(code=1, ...)
    error when I run the IOS code. Anybody run into this issue? It throws the error on this line in the
    mainIos
    source set:
    actual val engine by lazy { Ios.create() }
    would appreciate any insight 🙂
    s
    l
    m
    • 4
    • 8
  • c

    coolcat

    09/08/2020, 6:06 PM
    Is there a workaround to the current unavailability of
    kotlinx-coroutines-core-native:1.3.9
    ?
    s
    s
    • 3
    • 3
  • j

    Jake

    09/08/2020, 7:10 PM
    When starting a new KMM application, I ran into a crash on iOS that I’m trying to make some sense of. The error message is:
    Uncaught Kotlin exception: kotlin.native.concurrent.FreezingException: freezing of com.ramseysolutions.proportalspike.shared.Globals.Companion@f13308 has failed, first blocker is HttpClient[io.ktor.client.engine.ios.IosClientEngine@f13488]
    The offending code was:
    kotlin
    
    val json = kotlinx.serialization.json.Json { ignoreUnknownKeys = true }
    fun createHttpClient() = HttpClient() {
        install(JsonFeature) {
            serializer = KotlinxSerializer(json)
        }
    }
    
    
    class Globals {
        companion object {
            client = createHttpClient()
        }
    }
    The iOS application utilizes that client in its first view. I noticed in my debugging, that the breakpoints in my iOS project were never getting hit. So I determined the crash was happening before the class that was referencing
    client
    was ever created. Working that theory, I was able to stop the crash from occurring and achieve the correct results on iOS and Android by removing that
    client
    property from the
    companion object
    and by creating a global variable in the iOS project:
    // Kotlin Shared
    
    class Globals {
        client = createHttpClient()
    }
    // iOS
    let globals = Globals()
    After resolving that, I asserted that a simple global variable would fail also, and I was correct when I tested that. My questions are: what was causing the failure? Are Coroutines unavailable until a certain point in the iOS application lifecycle? And what resources or tools can I use to figure that type of thing out on my own?
    i
    d
    • 3
    • 5
  • l

    Logan Knight

    09/08/2020, 7:21 PM
    Hey all, new to Kotlin, come from a js background. Playing with https://github.com/Kotlin/kotlin-full-stack-application-demo, HMR fails. It looks like
    PROJECT_ROOT/build/js/packages/kotlin-full-stack-application-demo-client/kotlin/kotlin-full-stack-application-demo-client.js
    gets deleted during
    compileKotlinJs
    task which causes HMR to fail out with
    Error: ENOENT: no such file or directory, open
    . I'm trying to wrap my head around the config and it seems I need to have the task ``compileKotlinJs`` not clear the folder and just overwrite the content, but I'm not quite sure how, or if that's the correct solution.
    r
    • 2
    • 8
  • d

    dazza5000

    09/08/2020, 10:11 PM
    message has been deleted
    s
    • 2
    • 2
  • s

    Sarah-Jane Gallitz

    09/09/2020, 12:09 AM
    Hey all, new to KMP. I was wondering, is it possible to publish a “kotlin” library for use in multi platform projects? I don’t want Library A (kotlin code, no dependencies) to have to compile for every target that Library B wants to use. Especially with regards to macOS/iOS targets. If not, is it possible to compile for iOS targets (assuming we don’t use any of the framework code) without a mac?
    d
    l
    n
    • 4
    • 12
  • n

    Nikita Khlebushkin

    09/09/2020, 7:53 AM
    Hello! Is there a sample project or a tutorial for K1.4 on how to build and publish Kotlin project as a Cocoapods?
    d
    i
    • 3
    • 2
  • t

    Thomas Skovsgaard

    09/09/2020, 1:15 PM
    Hi, I keep getting this error
    There is no event loop. Use runBlocking { ... } to start one.
    from the iOS part, I use kotlin 1.4, coroutines 1.3.9 and my iOS dispatcher is based on this https://github.com/JetBrains/kotlinconf-app/blob/33f2d4e65f470d1444c5d4b46249af8feb243d03/common/src/iosMain/kotlin/org/jetbrains/kotlinconf/DispatcherNative.kt I have tried using native-mt with Dispatchers.Main but this gives me another error
    Fatal exception in coroutines machinery for CancellableContinuation
    The Android part works as expected. I have searched and tried a lot of solutions, but can't seem to figure out what's going wrong, any guidance is much appreciated 🙂
    i
    k
    +3
    • 6
    • 18
  • m

    Maurice Jouvet

    09/10/2020, 7:38 AM
    I have this error on iOS when I'm calling my suspend KTOR functions.
    Uncaught Kotlin exception: kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[WorkerCoroutineDispatcherImpl@1364278, Continuation @ $split$lambda-0$<anonymous>_3COROUTINE$2]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
    HttpClient: RESPONSE <https://app.bluekango.com/mobile/app/login> failed with exception:
    kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.AwaitAll.AwaitAllNode@3eeba78
    I have done some research and found that there are some issues with Ktor/Coroutines, but I don't know what can I do to avoid this issue..? I tried to retrograde my version (not working with my current project) and I'am already using the specific agent engine for iOS or Android. But not working. Link: https://github.com/ktorio/ktor/issues/1550
    v
    • 2
    • 2
  • o

    Oleh

    09/10/2020, 8:00 AM
    Hey guys, having pretty similar issues to the described above and cannot fix it
    kotlin.native.concurrent.FreezingException: freezing of InvokeOnCompletion[InvokeOnCompletion@360fd08] has failed, first blocker is HttpClient[io.ktor.client.engine.ios.IosClientEngine@362a408]
    freezing of InvokeOnCompletion[InvokeOnCompletion@360fd08] has failed, first blocker is HttpClient[io.ktor.client.engine.ios.IosClientEngine@362a408]
    I’m running
    const val kotlinVersion = "1.4.0"
    const val coroutinesVersion = "1.3.9-native-mt"
    const val ktorVersion = "1.4.0"
    const val serializationVersion = "1.0.0-RC"
    Anyone can help?
    k
    j
    +2
    • 5
    • 16
  • n

    Nicolas Bourdin

    09/10/2020, 10:05 AM
    Hello, I have a doubt about something in native kotlin https://kotlinlang.org/docs/reference/native/objc_interop.html#kotlin-singletons We agree that if I declare an object like this
    object MyObject {
    val property: String = ""
    }
    In swift, I can call this singleton like this
    MyObject().property
    , it will not recreate a new instance of MyObject each time?
    t
    • 2
    • 1
  • d

    Daniel Rampelt

    09/10/2020, 8:01 PM
    Anyone else run into issues with the cocoapods plugin using 1.4.10? No issues with 1.4.0.
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':tasks'.
    > Could not create task ':shared:podInstall'.
       > Task with name 'podspec' not found in project ':shared:api'.
    l
    • 2
    • 5
  • h

    Hailong

    09/11/2020, 8:22 AM
    Hi guys! I am a Chinese developer and I am trying KMP recently. I have done enough research and it is great, and I am going to try KMP, but there are still two questions I haven’t found answers to. The questions are as follows: 1. What is the planning and ultimate goal of KMP in the later stage? 2. The principle of KMP compiler I wonder if there are any Kotlin related developers or others who can help me? thank you very much!
    l
    • 2
    • 2
  • h

    hallvard

    09/11/2020, 9:00 AM
    Today's not-very-funny: I have a multiplatform project that I use as a dependency in several other projects (of course), and today, these other projects suddenly couldn't find my new snapshot versions ... (continued (and solved!) in thread)
    • 1
    • 5
  • l

    louiscad

    09/11/2020, 1:13 PM
    Hi, I found this gradle property in kotlinx.coroutines repo:
    kotlin.mpp.enableCompatibilityMetadataVariant=true
    What does it do exactly? I'm interested because I'm in the process of testing publishing and consumption of multiplatform libraries (Android, native, JS and JVM).
    o
    e
    +2
    • 5
    • 6
Powered by Linen
Title
l

louiscad

09/11/2020, 1:13 PM
Hi, I found this gradle property in kotlinx.coroutines repo:
kotlin.mpp.enableCompatibilityMetadataVariant=true
What does it do exactly? I'm interested because I'm in the process of testing publishing and consumption of multiplatform libraries (Android, native, JS and JVM).
o

Oleg Yukhnevich

09/11/2020, 1:28 PM
If I understand correctly (from kotlin code and some info in the internet) it needed if you are enabling HMPP (
enableGranularSourceSetsMetadata=true
) and want to allow users which don't use HMPP to consume your library
👍 1
l

louiscad

09/11/2020, 1:31 PM
@elizarov Can you confirm? Anything to add? Also, is it related to that issue?
e: Could not find "kotlinx-coroutines-core_concurrentMain"
https://kotlinlang.slack.com/archives/C1CFAFJSK/p1597886480055300
e

elizarov

09/11/2020, 1:32 PM
Yes. It makes it compatible with non-HMPP consumers, generating old-style metadata, too.
👌 5
w

william

09/13/2020, 3:48 PM
what is HMPP?
➕ 1
l

louiscad

09/13/2020, 4:12 PM
@william Hierarchical Multiplatform Projects
👍 2
m

mbonnin

10/05/2020, 11:18 AM
Any reason this is not the default? It feels like this is what most people want?
👀 1
View count: 4