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

    wakingrufus

    01/16/2019, 3:17 AM
    if i have a gradle multi project build, and one subproject is an MPP project, how can another subproject, which is a regular jvm project, depend on the jvm output from the MPP project?
    d
    h
    • 3
    • 9
  • h

    h0tk3y

    01/16/2019, 10:32 AM
    Hi everyone, In the latest 1.3.20 EAP, we've added a few improvements to Multiplatform Projects, including publishing Android libraries (AAR) as a part of a multiplatform library. See the details in the thread. You are welcome to try it and share your feedback!
    🎉 6
    👍 17
    📦 1
    h
    a
    +2
    • 5
    • 36
  • r

    russhwolf

    01/17/2019, 4:17 AM
    I’m having trouble consuming a library using single-variant aar publishing in eap-100. See sample project at https://github.com/russhwolf/AndroidLibDemo Here’s my process: 1. run
    ./gradlew clean build check publishToMavenLocal
    in root directory 2. run
    ./gradlew clean build check
    in
    app
    directory If the library used
    publishAllLibraryVariants()
    this works fine, but if I do
    publishLibraryVariants("release")
    I get an error because the debug app build can’t figure out which library variant to use.
    h
    • 2
    • 9
  • r

    russhwolf

    01/17/2019, 4:19 AM
    Also, another issue: The android tests in
    app
    fail to build unless I add the library dependency to both
    commonMain
    and
    commonTest
    .
    ➕ 1
    h
    • 2
    • 1
  • g

    galex

    01/17/2019, 6:34 AM
    Hello, could someone explain what happened to the multiplatform plugin? I guess I missed the last big change, from “kotlin-platform-common” to “org.jetbrains.kotlin.multiplatform”. Before that change, we were supposed to have one module for common, one per platform and then our projects depends on those platform modules. Now with org.jetbrains.kotlin.multiplatform all of the common + platform specific code is built under one only module? Is that correct?
    g
    • 2
    • 2
  • e

    einar

    01/17/2019, 10:19 AM
    Is there a good tutorial/example-project out there describing how to setup SQLDelight in a multiplatform project (Android/iOS)?
    a
    k
    • 3
    • 14
  • t

    Tzahi Moyal

    01/17/2019, 10:37 AM
    Hi, I’m trying to compile iOS framework with all architectures support Arm64 and iosX64, someone knows how to do it?
    s
    j
    • 3
    • 5
  • a

    alexfacciorusso

    01/17/2019, 2:16 PM
    Hello everyone! I can’t find anything about how to change the generated framework (ios) name in the multiplatform project build.gradle file. Does anyone know how to do that?
    s
    • 2
    • 1
  • n

    nikolaymetchev

    01/17/2019, 4:20 PM
    Hello I have an inline function defined in kotlin and compiled to javascript using kotlin multiplatform. It appears as though that function doesn't get exported and so I cannot use it from javascript. Am I correct in making this deduction?
    g
    • 2
    • 8
  • k

    kgonyon

    01/17/2019, 4:27 PM
    Hello, I am currently trying to make a multiplatform library for our android and ios applications. I have everything except I want to pull in the Firebase SDK for ios using cinterop. I have everything hooked in and working except when I build the linker gives me the following error.
    Undefined symbols for architecture arm64:
      "___isOSVersionAtLeast", referenced from:
          +[GULAppEnvironmentUtil isAppStoreReceiptSandbox] in GoogleUtilities(GULAppEnvironmentUtil.o)
      "_utf8_nextCharSafeBody", referenced from:
          -[FSRWebSocket _innerPumpScanner] in FirebaseDatabase(FSRWebSocket.o)
    ld: symbol(s) not found for architecture arm64
    o
    s
    • 3
    • 5
  • d

    Diego

    01/18/2019, 12:53 PM
    Hello guys. I’m working on a multiplaform project, iOS and JVM (I’m not targeting Android directly). Depending on the build type (debug or release) I want to configure the logging level (i.e. to print only errors in release). Since there is no a
    BuildConfig
    class avaialble, how can I know from
    commonMain
    the build type?
    l
    • 2
    • 2
  • o

    o.semen

    01/18/2019, 1:20 PM
    is it possible to have frontend and android in the same multiplatform project? currently I’ve created mobile (Android/iOS) multiplatform project and when I added
    id 'org.jetbrains.kotlin.frontend' version '0.0.44'
    I received an error
    Cannot add task ':app:bundle' as a task with that name already exists.
    this task is created by
    com.android.application
    b
    • 2
    • 1
  • d

    darych

    01/19/2019, 10:14 AM
    Hi guys! Could someone suggest some good Github repository with multiplatform application (Android, iOs) to look at as an example? I know about kotlinconf-app but it looks like it was created before expect/actual feature was released. I'm new to mobile development, usually I create backend apps.
    o
    d
    k
    • 4
    • 6
  • t

    thana

    01/21/2019, 8:29 AM
    how do dependencies work in a MPP-world? consider a MPP with targets JVM and JS with a
    commonMain
    dependency on lets call it
    A
    . What does
    A
    have to provide in order to be usable as a dependency? Does
    A
    have ro provide a
    .class
    as well as a
    .js
    artifact? Does kotlin kompile `A`s kotlin code into the target's format?
    b
    • 2
    • 2
  • t

    thana

    01/21/2019, 9:01 AM
    i'd love to you use
    jtsgen
    , a project written in java that allows to generate typscript typings from java- and kotlin classes. the problem: it uses
    kapt
    to generate them which drives it more or less impossible. i'd need to use it as
    common
    -dependency to use the annotations which isn't possible and OTOH using kapt seems to be impossible in MPP, too. But there is a glimmer of hope left: in fact we would need this dependency only at compiletime and there is nothing left at runtime. Can anyone imagine a way to use it?
    o
    • 2
    • 7
  • k

    kkovach

    01/21/2019, 4:43 PM
    I just started messing around with multiplatform and have a little example compiling. I wrote a couple common tests and one is failing. I cannot figure out how to get more info (stdout/stderr) or some kind of logging for my tests. I've spent a bunch of time looking for an example or docs and haven't found anything yet. Any help would be greatly appreciated. Thanks!
    t
    • 2
    • 4
  • a

    Ashley Figueira

    01/21/2019, 6:05 PM
    I cant seem to get the dependencies for iOSMain working. Can anyone help? Using gradle 4.10.1 and kotlin 1.3.20-eap-100 as in the kotlin example layed out by jetbrains.
    r
    p
    • 3
    • 8
  • a

    Alexander

    01/21/2019, 9:41 PM
    How can I use
    ktor-http
    dependency in a multiplatform project? I added
    io.ktor:ktor-http
    dependency inside the
    commonMain
    . As
    ktor-http
    is a multiplatform library itself I expected this should be enough. But for
    jvm
    I should also add
    io.ktor:ktor-http-cio
    and for
    js
    it only works if there is
    io.ktor:ktor-client-js
    dependency. Why is single common dependency not enough?
    o
    • 2
    • 2
  • k

    kgonyon

    01/21/2019, 9:58 PM
    Is there a way to grab a
    KClass
    of an object defined in Kotlin from Swift? I have a function defined in Kotlin that has an argument
    type: KClass
    and I need a way to call that function from Swift, but not sure how to pass in the type.
    s
    • 2
    • 7
  • s

    Slackbot

    01/22/2019, 8:46 AM
    This message was deleted.
    o
    • 2
    • 1
  • o

    Oleg Yukhnevich

    01/22/2019, 9:17 AM
    Hey, may be someone now, if there is exists a list of all(almost all) MPP libraries? Not only from JB
    o
    i
    +2
    • 5
    • 6
  • d

    Drew

    01/22/2019, 5:31 PM
    Hello. I am currently struggling with another issue regarding Kotlin MPP. I am unable to successfully execute a request using Ktor on iOS. It always throws an InvalidMutabilityException. I have a vague understanding of the mutability aspect, but can't figure out why it's being thrown on Ktor. From iOS
    kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen io.ktor.client.request.HttpRequestPipeline@3f59548
    I've tried downgrading to Kotlin 1.3.10, as that seemed to be suggested on SO. However, it still throws the same exception. Kotlin 1.3.11/10 Ktor 1.1.1 Coroutines 1.1.0
    a
    p
    • 3
    • 5
  • b

    basher

    01/22/2019, 7:41 PM
    Does anyone here have
    @Serializable
    working on multiplatform building for iOS? Running into this build error:
    cannot access 'Serializable': it is internal in '<http://kotlin.io|kotlin.io>'
    I've checked the existing GH issues where it appeared people just had import/plugin issues, but I think I'm doing that right: -
    apply plugin: 'kotlin-multiplatform'
    -
    apply plugin: 'kotlinx-serialization'
    -
    implementation: "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:${versions.serialization}"
    -
    import kotlinx.serialization.Serializable
    Something I'm missing?
    k
    d
    +2
    • 5
    • 23
  • r

    Rak

    01/22/2019, 10:30 PM
    I’m looking to get started, can anyone recommend any good tutorials?
    a
    • 2
    • 7
  • a

    ankushg

    01/22/2019, 11:58 PM
    Maybe a dumb/obvious question: I have a KMPP that I'm currently building for JS and JVM. I expose multiple simple functions (no threading/coroutines or I/O) written in Kotlin in each of these libraries, and then call them on each platform via interop. I'm currently just using JavascriptCore on iOS with the JS artifacts, but my next step is to spit out iOS frameworks too. The project consists of several Gradle modules with interdependencies (i.e., module A has no project dependencies, module B depends on A, module C depends on A and B). Is this configuration supported for KMPPs targetting iOS? If so, is there some example of a multi-module KMPP that spits out either an all-in-one iOS framework, or multiple interdependent framework files?
    d
    • 2
    • 1
  • a

    addamsson

    01/23/2019, 12:21 PM
    Does anybody know a solution for this problem? https://stackoverflow.com/questions/54327143/how-to-create-a-dynamic-proxy-in-kotlin-common-code
    g
    e
    +2
    • 5
    • 53
  • h

    hmole

    01/23/2019, 2:41 PM
    Is there a way to depend on a dependency with
    0.3
    `.metadata`while being on
    0.4
    ? I'm trying to use
    ktor-client-ios-iosx64
    , but it won't import with
    GRADLE_METADATA
    enabled.
    r
    m
    +2
    • 5
    • 7
  • d

    Drew

    01/23/2019, 10:29 PM
    I’m having a strange issue: Whenever I do a Gradle sync / refresh in a MPP project, all the iOS Native dependencies (i.e. WatchKit) are re-downloaded. It seemed to stop a few days ago, but now it’s doing it again. Anyone else experience this?
    d
    • 2
    • 4
  • h

    hmole

    01/24/2019, 8:18 AM
    @h0tk3y Is this now the correct way of declaring ios preset dynamically?
    def iosTarget = project.findProperty("IOS_TARGET")
    kotlin {
      targetFromPreset(presets[iosTarget], "ios")  {
    
      }
    }
    h
    • 2
    • 1
  • b

    bdeg

    01/24/2019, 11:12 AM
    Can kotlin js generate typescript code? I'm writing my app business logic with kotlin multi-platform, I want the ui to be build with flutter, so I can ship it quickly for ios and android. However dart don't intereop with kotlin, even if I'm using platform channel this make me duplicate many things like pojos ect. Dart has intereop with typescript so if kotlin js genereted typescript files maybe I could reuse them in dart, for minimal stuff like pojo ect.
    c
    t
    a
    • 4
    • 8
Powered by Linen
Title
b

bdeg

01/24/2019, 11:12 AM
Can kotlin js generate typescript code? I'm writing my app business logic with kotlin multi-platform, I want the ui to be build with flutter, so I can ship it quickly for ios and android. However dart don't intereop with kotlin, even if I'm using platform channel this make me duplicate many things like pojos ect. Dart has intereop with typescript so if kotlin js genereted typescript files maybe I could reuse them in dart, for minimal stuff like pojo ect.
c

coolcat

01/24/2019, 11:36 AM
Interesting approach
t

thana

01/24/2019, 11:38 AM
no, kotlin does not yet generare typescript nor typings
there is a ticket requesting this feature, which was recently targeted to kotlin 1.4.
a

addamsson

01/24/2019, 11:55 AM
Why don't you dump dart and just use Kotlin instead?
b

bdeg

01/24/2019, 1:52 PM
Because in this case It's double the time of development @addamsson, and my knowledge of ios its basic.
@thana any link to the ticket?
t

thana

01/24/2019, 1:55 PM
https://youtrack.jetbrains.com/issue/KT-16604
b

bdeg

01/24/2019, 2:12 PM
Thanks! @thana
View count: 12