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

    rjhdby

    12/29/2018, 10:44 AM
    Hello. Is there best practics for returns platform Type from
    expect
    function? For example,
    Drawable
    for android and
    UIImage
    for ios?
    g
    i
    a
    • 4
    • 5
  • k

    kpgalligan

    12/29/2018, 4:34 PM
    Are there any samples of building an ios framework using new eap builds? 1.3.20+ versions? My current config fails, and thought I'd ask before I go digging.
    t
    • 2
    • 1
  • r

    Robert

    12/29/2018, 9:12 PM
    I try to implement
    LinkedList<E>
    (from Java), but what Kotlin list should I extend?
    ArrayList
    is final, so can't use that, and just
    List
    makes me implement every method myself 😞 extending
    MutableList
    is even worse....
    d
    d
    +2
    • 5
    • 15
  • d

    Dhanapal

    01/02/2019, 5:57 AM
    Hi All, What is the best/recommended way to migrate existing mobile apps with Kotlin Multiplatform. I am planning to create a MPP library with app network calls and other common util classes from existing app. Thanks.
    n
    • 2
    • 4
  • j

    jlleitschuh

    01/03/2019, 11:59 PM
    Also, there doesn't seem to be any way of defining what kind of JS module is being created. CommonJS vs umd vs anything else. If anyone has suggestions in that area, that would be great.
    h
    • 2
    • 3
  • s

    sashjakk

    01/04/2019, 12:10 PM
    Hey, would be nice if somebody could point what I am doing wrong 😅 trying to get mpp common module working on iOS. Able to run it on Android, however iOS showing
    kotlin.TypeCastException
    🤨 Common part:
    @Serializable
    data class Post(
        val userId: Long,
        val id: Long,
        val title: String,
        val body: String
    )
    
    class KtorClient : CoroutineScope {
        private val httpClient = HttpClient()
    
        override val coroutineContext: CoroutineContext
            get() = Job()
    
        fun getPosts(callback: (String, Throwable?) -> Unit) {
            launch {
                try {
                    val raw = httpClient.get<String> {
                        url("<https://jsonplaceholder.typicode.com/posts>")
                    }
                    println(raw)
                    callback(raw, null)
                } catch (e: Throwable) {
                    callback("", e)
                }
            }
        }
    }
    iOS part:
    let client = KtorClient()
            client.getPosts { (posts: String, error: KotlinThrowable?) -> KotlinUnit in
                if (error != nil) {
                    error?.printStackTrace()
                    print(error?.cause ?? "oups")
                    print(error?.message ?? "oups")
                    return KotlinUnit()
                }
                
                print(posts)
                
                return KotlinUnit()
            }
    d
    s
    c
    • 4
    • 12
  • a

    aljosa

    01/04/2019, 3:14 PM
    i regularly see swift (or objc) code in mpp project but based on my understanding kotlin has direct access to android and ios platform api and anything that can be achieved with swift can be implemented w/ kotlin. am i missing something or do people just use swift because they have expertise and legacy code?
    n
    j
    +2
    • 5
    • 5
  • c

    coletz

    01/04/2019, 5:13 PM
    So I created a new mpp project (ios+android) with intellij idea tool but I'm unable to create gradle wrapper. There's no build setup in my list, only build and cleanup, nothing between these 2. Am I the only one having this issue? https://kotlinlang.slack.com/archives/C3PQML5NU/p1544541476138600 EDIT: was looking on a subproject, not the root one
    p
    n
    • 3
    • 4
  • o

    Oleg Yukhnevich

    01/04/2019, 8:59 PM
    Hi, can someone help why this is work with gradle groovy but not with gradle Kotlin?
    -.kt
    p
    l
    • 3
    • 4
  • a

    Andrey Gromov

    01/07/2019, 8:11 AM
    Hi! I trying to make android/iOS project, but have some problems with dependencies for "actual" part of common code. (details inside thread, coming soon)
    i
    n
    • 3
    • 7
  • w

    Willis

    01/08/2019, 12:22 PM
    Anyone here used mockK to test their common code in multiplatform project? I’m having an
    Unresolved reference: mockK
    error when building/executing the test even if InteliJ autocompletion finds the library without any problem 😕
    s
    j
    • 3
    • 8
  • d

    Dominaezzz

    01/08/2019, 6:24 PM
    I'm trying to setup a multiplatform application project but I can't figure out how to (nicely) get the generated jar to execute it. In the native case there's
    kotlin.targets.mingw.compilations.main.getBinary('EXECUTABLE', buildType)
    to get the binary for execution. What is the jvm equivalent?
    kotlin.targets.jvm.compilations.main.getJar('EXECUTABLE', buildType)
    doesn't work 🙂.
    r
    h
    • 3
    • 6
  • k

    kpgalligan

    01/08/2019, 7:28 PM
    https://twitter.com/Strongolopolis/status/1082719241239965697
    🙌🏼 3
    🎉 16
    p
    • 2
    • 1
  • b

    bdeg

    01/09/2019, 9:06 AM
    Hi guys, so this year, I'm planning to open source some of my internal libraries, gradle plugin, Jenkins script and Jenkins plugins, maybe someone other than me and my team will find them useful. Today I have published the first one. As my first public library I decided to publish my lightweight clean architecture library. This library only contains building block for clean architecture applications. I use it for most of my project and it's a multi-platform project so you can use it for android, Java backend, Ios, Javascript. Library: https://bintray.com/bitsydarel/maven/clean-arch Maven repository : https://dl.bintray.com/bitsydarel/maven/
    r
    • 2
    • 2
  • q

    qlitzler

    01/09/2019, 1:37 PM
    I have two android library modules called
    androidMain
    and
    helper
    . I'd like for
    helper
    to have a dependency on
    androidMain
    , but I can't figure out how to make the usual
    implementation project(':main')
    work. I keep geeting this error:
    roject with path ':main' could not be found in root project 'instantsearch-kotlin'.
    I've read this paragraph on the website but that didn't really help. https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#disambiguating-targets. Any help would be greatly appreciated !
    Untitled.groovy
    d
    d
    • 3
    • 3
  • p

    pandawarrior

    01/10/2019, 6:00 AM
    A quick question, if I want to compile both iosX64 and iosArm64 that shares the same directory, e.g.
    iosMain/kotlin
    . How should I go about it? kotlin { targets { fromPreset(presets.android, ‘android’) fromPreset(presets.iosArm64, ‘ios’) { compilations.main.outputKinds(‘FRAMEWORK’) } }
    h
    • 2
    • 2
  • a

    alexfacciorusso

    01/10/2019, 10:15 AM
    and_this_is_my_Gradle_conf.groovy
    j
    • 2
    • 3
  • a

    alexfacciorusso

    01/10/2019, 5:17 PM
    Sorry if today I’m cross-posting everywhere lol 😄 Has anyone used Ktor in a mpp environment and Json serialization? https://kotlinlang.slack.com/archives/C0A974TJ9/p1547140430248900
    e
    k
    p
    • 4
    • 4
  • k

    kpgalligan

    01/11/2019, 2:23 PM
    If anybody's interested, a sqldelight version published for 4.7. Its not quite the same as 1.0 but functional
    j
    • 2
    • 3
  • k

    kpgalligan

    01/11/2019, 2:26 PM
    They might be waiting for next native version. 1.1 apparently doesn't work with 1.0. Also maybe a resoltion on coroutines
    • 1
    • 1
  • d

    Dico

    01/11/2019, 3:19 PM
    I would like to make a multiplatform project with only jvm targets. However, the common source set can't access the JRE classes. I tried adding them as a dependency like so:
    implementation(fileTree("$directoryJre/lib/ext"))
    which makes them show up in the gradle view of intellij, but it does not work. The same goes for other java dependencies I add in the common source set. It would be useful to be able to configure a multiplatform project as jvm-only, allowing java dependencies as well as the JRE to be accessed from the common source. I have a few use cases where the ability to use expect/actual declarations would be invaluable, and I'm sure that there would be more: • I have a project that I would like to implement as an external process or injected dll • Any project targeting one of a set of libraries per build, for example, minecraft server plugins that support multiple server platforms (bukkit, nukkit, sponge, glowstone) If something like this is already possible using some workaround, please do let me know.
    k
    i
    r
    • 4
    • 8
  • b

    basher

    01/11/2019, 6:32 PM
    Has anyone shipped an MPP project on iOS? If so, how are you dealing with no dSYMs for the release framework? 😅
    👍 1
    k
    • 2
    • 7
  • h

    hallvard

    01/11/2019, 10:54 PM
    Oh, I found a solution here: https://discuss.kotlinlang.org/t/problem-with-lazy-loading-and-lack-of-a-backing-field/1415. A little... special, the java interop here, but I guess that's the cost of automated handling of backing fields etc. Anyway, it now works, and that's the important part. Thanks, Cedric!
    d
    • 2
    • 4
  • c

    Cyrille QUÉMIN

    01/12/2019, 6:16 PM
    Hi guys, I am using Kotlin multiplatform 1.3.11 and I am working on a android/iOS library. I have trouble with some of the crypto related functions on iOS. So far I manage to successfully use CCCrypt, CCCryptorCreate, CCCryptorUpdate and CCCryptorFinal. However when I try to use asymmetric encryption method such as SecKeyCreateRandomKey I got a signal 11: Segmentation fault. Worth mentioning that I am testing those methods via unit test witch launch an iOS simulator without UI. I read that some other people had issue with encryption method and Kotlin native so maybe these are related?? If any of you has an idea ? And also how is it best to debug ? Can I debug Kotlin native code? How can I have a stacktrace or something that will help me identifying the root cause. I know for sure that the call that fails is SecKeyCreateRandomKey regardless of all the parameters variations i tried I always get a segmentation fault.
    • 1
    • 1
  • d

    Dico

    01/13/2019, 8:37 PM
    I have a multiplatform project targeting jvm, android and ios. I have a buildSrc module with
    kotlin-gradle-plugin:1.3.11
    as a dependency. The same version of the plugin is applied to the whole project. When building, I get the following error:
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':client-shared:compileKotlinJvm'.
    
    Caused by: java.lang.NoSuchMethodError: org.jetbrains.kotlin.incremental.BuildUtilKt.makeModuleFile(Ljava/lang/String;ZLjava/io/File;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/io/File;
    	at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompiler(GradleKotlinCompilerRunner.kt:102)
    	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:405)
    	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:309)
    	at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:270)
    <12 hidden>
    	... 29 more
    b
    • 2
    • 4
  • r

    Robert

    01/15/2019, 9:27 AM
    Is there a modInverse available in Kotlin (mpp)?
    d
    • 2
    • 2
  • h

    Hauke Radtki

    01/15/2019, 12:33 PM
    Is there a up-to-date resource that I can read regarding publishing a MPP library? I only get as far as publishing to mavenLocal
    o
    h
    • 3
    • 17
  • r

    Rak

    01/15/2019, 1:50 PM
    and how difficult?
    d
    o
    • 3
    • 2
  • a

    alexfacciorusso

    01/15/2019, 3:06 PM
    Hi guys. I’m writing a multiplatform app with network calls and coroutines. I have basically two Coroutine Dispatchers, one for main and one for i/o operations. On Android, these are defined as Dispatchers.Main and Dispatchers.IO. On iOS, though, I’ve implemented what I’ve seen on many projects/tutorials online: a custom
    dispatch_queue
    dispatcher that takes a native dispatch queue and calls a
    dispatch_async()
    on it. The tutorials I’ve seen, though, they use the same dispatch queue for running every operation (the main dispatch queue). Indeed if I try to create a new dispatch queue for network (a new thread), it says it can’t run stuff in it because it can’t use a “non blocked or shared object” on a different thread. Questions: 1. Is there a way to create two threads for two dispatchers and use them with coroutines in Kotlin MPP (I think not, since I’m seeing that there’s an issue filed for it); 2. How bad is running network and UI in the same thread but asyncronously? 3. Are there some limitations for this?
    k
    • 2
    • 12
  • t

    thevery

    01/15/2019, 4:52 PM
    Since there is no ETA for JB libs update for 4.10, maybe someone is retrofitting sqldelight 1.0.0 for 4.7?
    k
    r
    a
    • 4
    • 6
Powered by Linen
Title
t

thevery

01/15/2019, 4:52 PM
Since there is no ETA for JB libs update for 4.10, maybe someone is retrofitting sqldelight 1.0.0 for 4.7?
k

kpgalligan

01/15/2019, 7:45 PM
I’m a maybe on that. I really need it for full app builds, but hoping we get a nice version surprise with 1.3.20. I’m pretty sure native is version 1.1 in Kotlin 1.3.20, and at least in eap, 1.0 and 1.1 libs are incompatible, so it would make sense that JB would hold off and do a broad update.
👍 1
The code changes aren’t much, but the build config changes required are fairly tedious.
t

thevery

01/15/2019, 8:11 PM
Yeah, the main question is build config
r

russhwolf

01/15/2019, 9:19 PM
You two probably already know, but if anyone wants to track this it's https://youtrack.jetbrains.com/issue/KT-29045
:tnx: 3
a

alec

01/15/2019, 11:20 PM
starred + watched!
(everyone else should too)
👍 3
View count: 2