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

    electrolobzik

    09/28/2020, 12:29 PM
    Hey guys, I am looking for a toolset which has short learning curve and allows to build both web apps and mobile apps using Kotlin Multiplatform. I want to make rapid prototype app for Android/iOS and Web. I am mobile developer and having not much experience with web development I am not sure how KMP works here and does it make sense to use it in this case. What do you think and what would you use in my case? Is it already easy to integrate shared KMP logic with mobile UI-frameworks like Flutter or is there any better choice? Will it also work for web app or needs some separate technology stack?
    w
    j
    • 3
    • 5
  • w

    william

    09/28/2020, 12:44 PM
    is there anyway to achieve an
    actual
    value in an
    expect class
    which references a value not given yet? for example I want to achieve
    val incoming: ReceiveChannel<Frame>
    val incomingText: Flow<String> = incoming.consumeAsFlow().filter { it is Frame.Text }.map { (it as Frame.Text).payload }
    where
    incomingText
    is basically a convenience method to give to consumers of that class. the error here states
    Expected property cannot have an initializer
    f
    j
    • 3
    • 12
  • m

    Mikołaj Kąkol

    09/28/2020, 1:05 PM
    hi, what is the best practice for exporting
    js
    lib to npm repository? any nice sample?
    ➕ 1
    a
    d
    k
    • 4
    • 4
  • c

    coolcat

    09/28/2020, 5:19 PM
    Please could somebody give me an idiot's guide about the difference between exporting my KMP iOS module as a static or dynamic module. Specifically: how you create each kind, and why you'd want to do one rather than the other.
    k
    a
    • 3
    • 8
  • v

    Vkbookworm

    09/28/2020, 6:59 PM
    is anyone facing issue related to import, i have added the cocoapods for the dependency but it's not importable in ios shared code. this is what i have added into my shared module gradle file.
    cocoapods {
            // Configure fields required by CocoaPods.
            summary = "Kotlin Multiplatform Firebase login sample"
            homepage = "<https://github.com/worstkiller/firebaseloginkmm>"
            pod("FirebaseAuth")
            frameworkName = "firebaseLoginSDK"
        }
    can anyone help ? 🙄 @Artyom Degtyarev [JB]
    a
    a
    • 3
    • 2
  • v

    Vinod Rai

    09/29/2020, 6:55 AM
    -keepattributes *Annotation*, InnerClasses
    -dontnote kotlinx.serialization.SerializationKt
    -keep,includedescriptorclasses class com.yourcompany.yourpackage.**$$serializer { *; } # <-- change package name to your app's
    -keepclassmembers class com.yourcompany.yourpackage.** { # <-- change package name to your app's
        *** Companion;
    }
    -keepclasseswithmembers class com.yourcompany.yourpackage.** { # <-- change package name to your app's
        kotlinx.serialization.KSerializer serializer(...);
    }
    The package name is changed,..getting exception in kotlinx.serialization 1.0.0-RC
    Serializer for class 'e' is not found.
        Mark the class as @Serializable or provide the serializer explicitly.
    Data classes are in shared code. Why progaurd configuration is not working with minify enabled. can anyone help what I am missing here?
    s
    • 2
    • 2
  • z

    zeugederunity

    09/29/2020, 8:50 AM
    Hello everyone, is it possible to have multiple JVM targets? Like for a Server-Backend and a Microservice? Edit after Jakub asked: The server is written with ktor and we want to Spark NLP for our new search feature. But i don't want to mix the code from the microservice with the server code.
    k
    j
    • 3
    • 5
  • m

    Mikołaj Kąkol

    09/29/2020, 12:21 PM
    Hello JB, is there plan to add
    watchosX64
    architecture? That would enable developing app on ⌚ simulator
    l
    a
    • 3
    • 6
  • c

    coolcat

    09/29/2020, 12:46 PM
    Is it possible to debug Kotlin in Xcode 12? I followed instructions here https://github.com/touchlab/xcode-kotlin/issues/16 but I can't set breakpoints in Kotlin.
    m
    s
    • 3
    • 10
  • d

    Diego

    09/29/2020, 1:07 PM
    Hello guys, I'm trying to configure a Kotlin multiplatform project with coroutines but the build fails with the following error:
    > Task :compileKotlinIosArm64 FAILED
    w: skipping /Users/XXX/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-iosarm64/1.3.8/ab1f410af27e33b328b0e7b3b75875953822e9eb/kotlinx-coroutines-core.klib. The abi versions don't match. Expected '[17]', found '22'
    w: The compiler versions don't match either. Expected '[]', found '1.3.71-release'
    e: Could not find "/Users/XXX/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-iosarm64/1.3.8/ab1f410af27e33b328b0e7b3b75875953822e9eb/kotlinx-coroutines-core.klib" in [/Users/XXX/Documents/Development/kotlin-multiplatform-spike/common, /Users/XXX/.konan/klib, /Users/XXX/.konan/kotlin-native-macos-1.3.61/klib/common, /Users/XXX/.konan/kotlin-native-macos-1.3.61/klib/platform/ios_arm64].
    Below my build.gradle file
    import org.jetbrains.kotlin.gradle.tasks.*
    
    plugins {
        id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
    }
    repositories {
        mavenCentral()
        jcenter()
    }
    group 'com.kotlin.common'
    version '0.0.1'
    
    apply plugin: 'maven-publish'
    
    kotlin {
        jvm()
        def iosFrameworkName = "KiplingCommon"
        def iOSTargetConfig = {
            binaries.framework {
                baseName = "$iosFrameworkName"
            }
        }
        iosX64("iosX64", iOSTargetConfig)
        iosArm64("iosArm64", iOSTargetConfig)
        sourceSets {
            commonMain.dependencies {
                implementation kotlin('stdlib-common')
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.8"
            }
            commonTest.dependencies {
                implementation kotlin('test-common')
                implementation kotlin('test-annotations-common')
            }
            jvmMain.dependencies {
                implementation kotlin('stdlib-jdk8')
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.8"
            }
            jvmTest.dependencies {
                implementation kotlin('test')
                implementation kotlin('test-junit')
            }
            iosMain {
                dependsOn(commonMain)
                iosX64Main.dependsOn(it)
                iosArm64Main.dependsOn(it)
                dependencies {
                    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.8"
                }
            }
            iosTest {}
        }
    }
    Any idea about why I receive that error and how to fix the problem. Thanks in advance!
    m
    • 2
    • 9
  • s

    streetsofboston

    09/29/2020, 2:35 PM
    In the IDE I get these red-lines/errors. Hsowever, it all builds and compiles without issue. My IDE is Android Studio 4.0.1, Kotlin 1.4.10, KMM Plugin 0.1.1 and 0.1.2 (tried both). I tried re-syncing gradle, re-build from scratch, invalidate caches & restart; all to no avial. Does anyone else see the same issue?
    k
    z
    +2
    • 5
    • 67
  • c

    chi

    09/29/2020, 6:10 PM
    What's the best resource to share with someone who knows only Android or iOS but wants to get into KMP. (assuming the person is a senior on either Android or iOS)
    k
    • 2
    • 1
  • f

    faogustavo

    09/29/2020, 6:57 PM
    1. How does the sourceSets understand and resolve the “parent” dependency? Is it some naming convention from gradle?
    r
    • 2
    • 3
  • f

    faogustavo

    09/29/2020, 6:57 PM
    2. How do I define that a module is jvm/native/js in the project architecture created by intellij? They are defined by some naming convention too?
    m
    • 2
    • 2
  • f

    faogustavo

    09/29/2020, 6:58 PM
    3. Is the default project architecture created by intellij good? Or is it better to create a “blank” project and add modules manually?
    m
    r
    • 3
    • 6
  • j

    John O'Reilly

    09/29/2020, 7:12 PM
    Is there particular pattern recommended for calling Kotlin method from Swift where that method in turns
    collects
    values from some
    flow
    source (e.g. db)
    ➕ 1
    a
    • 2
    • 5
  • k

    KamilH

    09/29/2020, 7:25 PM
    I’m trying to build Multiplatform library, I used a template “Mobile Library” from IntelliJ, implemented some basic stuff, added
    cocoapods
    plugin with some basic configuration. Then I built a project next I used
    podBuildDependenciesIos
    . Podspec files has been generated properly along framework. Then I added in my iOS project a pod with the library.
    pod install
    was also successful. When I’m trying to import library in the project I can do it (XCode sees the name of the library), however when I’m trying to build a project I’m getting an error
    No such module 'MobileLibrary'
    . What could be a problem?
    k
    • 2
    • 3
  • m

    Marcin Bak

    09/29/2020, 9:20 PM
    When I right click on kotlin source folder in commonMain there is no
    New
    ->
    Package
    action to create a package (which is there for jvmMain). Is there no packages concept in KMP or is it an issue with the IntelliJ?
    s
    b
    s
    • 4
    • 7
  • p

    Prateek Grover

    09/30/2020, 1:22 PM
    anyone sharing model classes in KN between android and iOS? Specifically for iOS, if we do this, there is a huge limitation where even if the object is created in Swift (model class resides in KN), we cant use that object from multiple threads How are you guys working around it? Freezing?
    s
    s
    • 3
    • 2
  • j

    janvladimirmostert

    09/30/2020, 3:58 PM
    For Kotlin Multimodule Multiplatform projects, how does one configure the plugin block? Currently doing it per sub project
    plugins {
    	val kotlinVersion = "1.4.10"
    	kotlin("multiplatform") version kotlinVersion
    	kotlin("plugin.serialization") version kotlinVersion
    }
    but it no longer compiles complaining that i'm redefining the Kotlin plugin i guess this now needs to move to the
    allprojects {
    block in the root build.gradle.kts i'm trying
    allprojects {
      	plugins.apply(kotlin("multiplatform"))
    }
    but that's not compiling any ideas?
    m
    • 2
    • 15
  • s

    SrSouza

    09/30/2020, 5:09 PM
    Hi folks, I want to know if in Kotlin 1.4 we can publish multiplatform libraries that uses only kotlin stdlib in common without needing to compile to every single platform
    m
    d
    +3
    • 6
    • 13
  • a

    Aaron Todd

    09/30/2020, 5:37 PM
    is there anyway to get a
    ByteArray
    backed by native C memory without a copy in Kotlin/Native?
    m
    • 2
    • 2
  • v

    Vikas Singh

    09/30/2020, 8:00 PM
    Do we need Xcode to add iOS application in android studio?
    :yes: 1
    m
    b
    k
    • 4
    • 4
  • a

    Arkadii Ivanov

    09/30/2020, 8:05 PM
    How stable is
    atomicfu
    ? Is it OK to use it in a library as implementation details?
    e
    k
    • 3
    • 4
  • k

    KamilH

    10/01/2020, 10:39 AM
    I want to be able to use
    main
    function inside
    jvmMain
    to test the library I’m working on, but when I’m trying to run main function it returns
    Error: Could not find or load main class MainKt
    for following function in
    Main.kt
    fun main() {
        runBlocking {
            userRepository.registerUser("")
        }
    }
    Are there any additional steps I should make to be able to use this?
    f
    m
    s
    • 4
    • 30
  • f

    faogustavo

    10/01/2020, 10:39 AM
    When I run the Maven Publish on to send the artifacts to bintray, each platform build is received as as version. Does anyone know how to fix it? 😬
    r
    • 2
    • 4
  • d

    dagomni

    10/02/2020, 6:40 PM
    Can we expect sometime in the future a preconfigured project template for Windows (WPF/UWP) connected to the gradle build - just like for iOS? 👀
    👀 1
    r
    a
    • 3
    • 2
  • s

    serebit

    10/02/2020, 11:31 PM
    Is it possible to disable publication for a specific target while still having it enabled overall?
    m
    • 2
    • 2
  • m

    Michal Harakal

    10/03/2020, 12:44 PM
    I have question following on discussion regarding multimodules and xcode framework. https://kotlinlang.slack.com/archives/C3PQML5NU/p1590965140229000 I have following setup. “umbrella module” -> ModuleA,ModulB I can see in ios(in header.h file) classes from ModuleA or ModuleB only if they are used in the umbrella Modulle itself. Which is normally fine, but my ModuleB are data classes and I would like to use them directly in iOS. How can I force, that classes from moduleB are exported too into xcode framework? Here link to the project (that are classes from the module “presentation” which are missing) https://github.com/dukecon/dukecon_mobile/blob/feature/kotlin-1.4-migration/shared/dukecon_umbrella/build.gradle.kts#L25
    l
    • 2
    • 3
  • m

    Michal Harakal

    10/03/2020, 8:52 PM
    I am still struggling around with exporting multimodules as xcode framework. Having this definition via shortcuts, where I want just add modules to export, gradle complains about
    Cannot create binary debugFramework: binary with such a name already exists
    ios {
            binaries {
                framework {
                    export(project(":shared:core"))
                    export(project(":shared:domain"))
                    export(project(":shared:presentation"))
                    export(project(":shared:data"))
                    export(project(":shared:backend:dukecon"))
                }
            }
        }
    I can add a namePrefix to framework definition like this
    binaries.framework("DukeconSdk"),
    but it actually creates second binary artifact in
    build
    folder, one with prefix containing exported modules, but cocopad used the original one anyway. What I am missing? I would like to have only one framework containg exports ..
    • 1
    • 2
Powered by Linen
Title
m

Michal Harakal

10/03/2020, 8:52 PM
I am still struggling around with exporting multimodules as xcode framework. Having this definition via shortcuts, where I want just add modules to export, gradle complains about
Cannot create binary debugFramework: binary with such a name already exists
ios {
        binaries {
            framework {
                export(project(":shared:core"))
                export(project(":shared:domain"))
                export(project(":shared:presentation"))
                export(project(":shared:data"))
                export(project(":shared:backend:dukecon"))
            }
        }
    }
I can add a namePrefix to framework definition like this
binaries.framework("DukeconSdk"),
but it actually creates second binary artifact in
build
folder, one with prefix containing exported modules, but cocopad used the original one anyway. What I am missing? I would like to have only one framework containg exports ..
Meanwhile I have found out, that it seems to be a
"native.cocoapods"
plugin comming a cross …
Ok, I found solution, ohh boy… https://dev.to/touchlab/multiple-kotlin-frameworks-in-an-application-34e9 anyway, thank you touchlab 🙂 @kevinschildhorn
View count: 10