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

    dimsuz

    05/07/2020, 4:33 PM
    Hi! Is there still no way to implement this interface in iOS?
    interface Props {
      fun payload(): Flow<MyPayload>
    }
    Last time I tried it there were problems a) with the fact that Flow<T> is a generic type b) no Flow accessible in Kotlin/Native. If not, what's the best thing I could do to get something similar working?
    a
    d
    • 3
    • 5
  • j

    Janelle Fullen

    05/07/2020, 5:31 PM
    Hi, is there a way to include the test classes of one subproject into another subproject so it can use them in its tests? I can't find a way to do this that works with my setup (I'm using the android plugin and multiplatform, and not the java plugin).
    r
    • 2
    • 2
  • w

    wingchi

    05/07/2020, 8:36 PM
    I’m trying to use KMP with Apollo and an existing schema. I’ve got things setup on the gradle side, but when I try to build with my schema and a basic query I get:
    Could not initialize class com.apollographql.apollo.compiler.parser.Schema
    Anyone run into something similar before?
    m
    • 2
    • 37
  • m

    michaelsims

    05/08/2020, 5:41 PM
    I'm attempting to build the cocoapods sample that is in https://github.com/JetBrains/kotlin-native/tree/master/samples/cocoapods but am running into issues. If I use the
    build.sh
    that is included, or if I follow the steps in
    README.md
    the result is the same. Attempting to build the shared Kotlin library fails during the gradle task
    cinteropAFNetworkingIOS
    :
    > Task :cinteropAFNetworkingIOS
    e: /Users/me/AndroidStudioProjects/cocoapods/kotlin-library/build/classes/kotlin/iOS/main/kotlin-library-cinterop-AFNetworking.klib-build/kotlin/cocoapods/AFNetworking/AFNetworking.kt: (71, 23): Unresolved reference: UIAxis
    e: /Users/me/AndroidStudioProjects/cocoapods/kotlin-library/build/classes/kotlin/iOS/main/kotlin-library-cinterop-AFNetworking.klib-build/kotlin/cocoapods/AFNetworking/AFNetworking.kt: (1988, 78): Unresolved reference: UIAxis
    e: /Users/me/AndroidStudioProjects/cocoapods/kotlin-library/build/classes/kotlin/iOS/main/kotlin-library-cinterop-AFNetworking.klib-build/kotlin/cocoapods/AFNetworking/AFNetworking.kt: (2077, 70): Unresolved reference: UIAxis
    I'm using CocoaPods 1.9.1, Java 1.8.0_77, Xcode 11.4.1 on OS X 10.15.4
    a
    t
    • 3
    • 4
  • s

    savrov

    05/10/2020, 3:50 PM
    Hi guys, is it possible to import a pure kotlin local module to mpp module? for ex, i have the structure: • MPP (depends on Pure) • Pure
    j
    • 2
    • 3
  • s

    savrov

    05/10/2020, 4:38 PM
    in continue of: https://kotlinlang.slack.com/archives/C3PQML5NU/p1589125830414200 I did the changes, so both modules are MPP now. I have to mention, that project structure is a bit more difficult, that just 2 models. I’m trying to combine Clean Architecture with MPP.  Priject structure is: • config (“pure-kotlin”) • domain (“pure-kotlin”) • data (“pure-kotlin”) • infrastructure (mpp module with android, jvm support) • utils (“pure-kotlin”) But as @Joffrey all these modules are MPP (with android and jvm support). And that’s a place where i got stuck. My
    :config
    has a dependency on
    :utils
    and buring build phase this dependency fails on
    Cannot choose between the following variants of project :utils:....
    .  I think that the reason is in defining targets in
    build.gradle
    files (every module have the same):
    jvm('backend') 
    jvm('android')
    So compiler does not know what to do. Neither me. =( If you have some thoughts or ideas how to solve this, please share, thank you
    u
    • 2
    • 4
  • a

    andrewreitz

    05/11/2020, 1:33 AM
    is there a way to specify with the multiplatform plugin what the main class of a jvm target is / create a jvm run target?
    • 1
    • 2
  • l

    Luka

    05/11/2020, 8:05 AM
    Hello . I have problems with adding ios framework to xcode. I use cocoapods plugin. It is generated without error and added to xcode project when "pod install" is called. But when i try to run it, i see this error:
    • 1
    • 2
  • c

    curioustechizen

    05/11/2020, 1:08 PM
    I have a mobile multiplatform app that is pretty close in structure to the KaMPKit sample. The app builds and runs fine. Now I added a Test target in XCode and the test target fails to build (even the default XCTestCase sub-class generated by XCode doesn't build). By looking into the build error, I isolated the problem to this: In my case, only
    shared.release.xcconfig
    is generated; I don't see
    shared.debug.xcconfig
    Has anybody faced this problem before? How do I get XCode to generate
    .xcconfig
    for all targets?
    w
    • 2
    • 15
  • j

    jdiaz

    05/11/2020, 7:27 PM
    Is it possible to implement an
    expect
    class in JVM with a property
    path
    and the extending class has a method
    getPath()
    ? (I'm talking about
    File
    class). I'm trying something like
    actual class MyFile extends <http://java.io|java.io>.File
    and MyFile has a property
    path
    .
    e
    • 2
    • 7
  • e

    edenman

    05/11/2020, 7:44 PM
    Anybody else doing expect/actual abstraction over color values? I’m trying to have a shared color palette between my apps but getting a compiler NPE when i reference UIColor constants: https://youtrack.jetbrains.com/issue/KT-38850
    s
    o
    • 3
    • 5
  • e

    Elizabeth Mezias

    05/11/2020, 8:58 PM
    Is anybody using an efficient and common file format for image assets across platforms, especially on Android and iOS? Webp is possible. There are several iOS libraries and SDWebImage looks good. Seems like using the same assets, even just the same process for converting assets would offer efficiency for a cross platform development team. I got a (IPA max) file size problem to fix with efficient formats and I want to solve it for the least number of design team file conversions and the fastest rendering.
    k
    m
    s
    • 4
    • 12
  • m

    Mustafa

    05/12/2020, 1:16 PM
    Anyone using Firestore here? I saw there was an unsupported kmp Firestore library but was wondering if anyone had any thoughts on it or whether REST API would be better.
    s
    k
    • 3
    • 5
  • j

    Janelle Fullen

    05/12/2020, 8:56 PM
    Has anyone successfully used a unit testing mocking library that works well with MPP? Looking for one.
    k
    m
    +2
    • 5
    • 11
  • a

    Andrei Marshalov

    05/13/2020, 8:11 AM
    Hello, I’m using
    maven-publish
    to publish my multiplatphorm library to
    maven
    repo. My publishing config looks like:
    project.afterEvaluate {
        publishing {
            publications {
                create<MavenPublication>("maven") {
                    groupId = projectGroup
                    artifactId = projectArtifactName
                    version = "${android.defaultConfig.versionName}"
    
                    tasks.getByName("bundle${buildType.capitalize()}Aar").outputs.files.forEach {
                        artifact(it)
                    }
                }
            }
    
            repositories {
                mavenLocal()
            }
        }
    }
    As a result of publishing i get several modules:
    └── repository
        └── com
            └── example
                ├── lib-ios
                │   ├── 1.0.0
                ├── lib-iossim
                │   ├── 1.0.0
                ├── lib-macos
                │   ├── 1.0.0
                ├── lib-metadata
                │   ├── 1.0.0
                └── lib
                    ├── 1.0.0
    After that i use this library in Android app as:
    dependencies {
        implementation("com.example:lib:1.0.0")
    }
    So it looks like i need to publish to
    maven
    only Android part of my library, since i use
    carthage
    to publish iOS part. How can i skip all target except Android for my publication?
    k
    • 2
    • 4
  • m

    mbonnin

    05/13/2020, 2:31 PM
    Is there a way to publish an Android library variant "merged", without specifying a
    BuildType
    attribute ? Something like only publish the
    release
    variant and only expose that to consumers ? Right now, when a user declares a custom
    BuildType
    in
    app/build.gradle.kts
    , variant matching doesn't find the android lib and fallbacks to the JVM
    s
    s
    t
    • 4
    • 10
  • j

    Joey

    05/14/2020, 6:28 AM
    Anyone tried publishing KMP in jitpack?
    a
    a
    • 3
    • 4
  • v

    vanniktech

    05/14/2020, 12:45 PM
    Has anyone been able to call
    NSLocalizedString
    within the ios target from a KMP project?
    a
    • 2
    • 2
  • d

    Derek Ellis

    05/15/2020, 1:08 AM
    This might be obvious, but I've published snapshot builds of a library I'm working on that targets the JVM, JS, and several Native targets. When I add the snapshots as a dependency in another MPP I can access the library just fine in the platform-specific code, but I can't from the common code and I have no idea why
    s
    • 2
    • 4
  • e

    edenman

    05/15/2020, 1:56 AM
    having trouble using
    ticker
    , the import won’t resolve (
    import kotlinx.coroutines.channels.ticker
    )….i know it’s marked obselete but seems like it should still work for now, right?
    • 1
    • 1
  • e

    Elka

    05/15/2020, 4:17 AM
    Hi, not sure if this is the appropriate channel, but has anyone tried a
    WITH
    clause in SQLDelight? I tried to write one but it is not working
    WITH removed_user AS (SELECT * FROM user WHERE isRemoved = 1);
    s
    • 2
    • 1
  • r

    Rostislav Utrobin

    05/15/2020, 5:10 AM
    Is it possible to get androidContext in androidMain?
    e
    u
    • 3
    • 3
  • j

    JoakimForslund

    05/15/2020, 8:06 AM
    Hi! Anyone knows what is going on here? Upgraded kotlin from 1.3.62 to 1.3.71 and now in my build.gradle.kts I get gradle error on
    val iosx64 = iosX64("iosX64")
    with the error message:
    org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension.iosX64(Ljava/lang/String;)Lorg/jetbrains/kotlin/gradle/plugin/mpp/KotlinNativeTargetWithSimulatorTests;
    I can't figure it out
    • 1
    • 2
  • b

    bsimmons

    05/15/2020, 2:47 PM
    Hey all, I'm looking for a low-level JSON library like klaxon that works in a MPP. (Unfortunately I'm dealing with a nasty REST API and simple serialization isn't really flexible enough.) Any suggestions?
    d
    c
    g
    • 4
    • 12
  • t

    taso

    05/16/2020, 7:13 AM
    When you add multiplatform plugin, you shouldn't add jvm or js too
    p
    • 2
    • 1
  • s

    Sam

    05/16/2020, 11:46 AM
    I'm setting up a multiplatform, multi-module project. I want to have a module
    A
    there which doesn't target any specific end-platform itself, but is acting as a "common" library which can be added into another multiplatform module
    B
    . Module
    A
    would make use of another multiplatform libs (stdlib, coroutines and sqldelight). It's the module
    B
    that will target
    Android
    and
    iOS
    . It seems it can't be done using
    kotlin-multiplatform
    plugin as a tooling. 1. Am I right? 2. Is there another tooling/plugin available that will allow me to configure such a "common" module?
    u
    k
    r
    • 4
    • 12
  • e

    Elka

    05/17/2020, 3:08 PM
    Hello, trying to debug Kotlin mulitplatform code on iOS using this plugin. 1. The lldb is not showing string values unless I use the
    po print(firstName)
    k
    • 2
    • 2
  • c

    Chetan Sachdeva

    05/18/2020, 9:17 AM
    Hi folks! I’m having a hard time setting up kotlin-mpp dependencies with ktor and kotlin-serialization. Is there a good example avaialable?
    c
    r
    r
    • 4
    • 8
  • j

    Jolas

    05/19/2020, 11:45 AM
    I am Planning to develop apps for Android and IOS platforms. I came across Kotlin/Native technology and found a huge potential to have shared logic via a single Kotlin/native module. But from tech docs and samples I’ve seen only pinch of an iceberg . I am wondering if it’s stable enough for production. Because still while running builds I get a message “Kotlin/native is experimental” So do you recommend Kotlin/Native to be used for production Android/IOS apps? React with 👍🏾 for yes 👎🏾 for not yet
    ✊ 1
    :thumbsup_all: 15
    g
    j
    +4
    • 7
    • 20
  • m

    Mustafa

    05/19/2020, 4:15 PM
    Can some explain to me if I wanted to use Firebase SDK for Android and IOS how I could use "expect" and "actual" to realize this? For example with Firestore.
    s
    c
    • 3
    • 8
Powered by Linen
Title
m

Mustafa

05/19/2020, 4:15 PM
Can some explain to me if I wanted to use Firebase SDK for Android and IOS how I could use "expect" and "actual" to realize this? For example with Firestore.
s

Sam

05/19/2020, 7:11 PM
Make a repo object that interfaces with Firestore and don’t expose anything Firestore related to the calling code. The expect code defines the methods available and the actual on each platform works with Firebase in the platform specific way.
c

Chuck Greb

05/19/2020, 10:13 PM
Here's a KMP Firestore implementation that uses expect/actual with mostly extension functions : https://github.com/touchlab/FirestoreKMP
☝️ 1
m

Mustafa

05/20/2020, 12:38 PM
@Chuck Greb yea first and one of 2 libraries that I have found on GitHub before asking this. The library isn't supported and the amount of code required is not worth me forking to maintain. I just want to use Rest API.
@Sam sounds good and easy for Android side but not sure how to do that with iOS side without native firebase library
s

Sam

05/20/2020, 12:43 PM
You could use the CocoaPods plugin to call it from the native side. Or use an already compiled binary and create a def file.
m

Mustafa

05/20/2020, 12:45 PM
@Sam could you link me an example doing this for any library?
And thanks for your help!
s

Sam

05/20/2020, 1:41 PM
I don’t have an example. These are the docs on it. https://kotlinlang.org/docs/reference/native/cocoapods.html
View count: 4