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

    louiscad

    07/21/2019, 1:32 PM
    Is the process of publishing a MPP library that supports both macOS and Windows documented somewhere? I know its something kotlinx.coroutines does, but the gradle setup there is quite complicated to me, plus I'm less and less familiar with Groovy based gradle as I use almost only Gradle Kotlin DSL since last year. I'd like to ensure my multiplatform publication can resolve using gradle metadata in the consumer projects dependeing on the targets, but I can't run the usual publishing task since I won't be able to compile for Windows on my Mac. A clear guidance or an example I can test with a dummy bintray repo, would be helpful.
    d
    k
    +2
    • 5
    • 26
  • y

    Yao Zhuanzhuan

    07/22/2019, 6:50 AM
    How can I use protobuf generated java code in JVM target in multiplatform ?
    l
    • 2
    • 1
  • j

    Jan Stoltman

    07/22/2019, 8:45 AM
    I'm trying to use kotlin
    Result
    in my K/Mpp project and I'm facing a lot of
    Result cannot be used as a return type
    warnings.
    freeCompilerArgs = ["-Xallow-result-return-type"]
    makes it so it can compile just fine, but the warnings are still there which is pretty annoying. Am I missing some other flag which would me allow to get rid of these IDE warnings?
    r
    g
    d
    • 4
    • 19
  • r

    robstoll

    07/22/2019, 10:43 AM
    what is the current state of the new multiplatform plugin. is it possible to have several JVM modules (say jvm, jdk8, jdk11) and share some code?
    d
    • 2
    • 5
  • k

    Kris Wong

    07/22/2019, 4:21 PM
    does anyone have an example of an MPP (not an app project) w/ an android library target?
    k
    r
    s
    • 4
    • 45
  • k

    Kris Wong

    07/22/2019, 8:13 PM
    let's say you wanted to create an iOS module with some UI that is built upon a kotlin MPP. and let's say you needed to integrate that module with an iOS app that already integrates a kotlin MPP. any thoughts on how to achieve something like that?
    s
    • 2
    • 5
  • g

    groostav

    07/22/2019, 8:22 PM
    Hey guys, if I wanted to call some kotlin-native compiled libraries from kotlin-jvm, is JNA still the best way to do it?
    s
    • 2
    • 3
  • m

    mbonnin

    07/22/2019, 9:45 PM
    What would be the build.gradle.kts equivalent of
    androidMain {
                dependencies {
                    implementation kotlin("stdlib")
                }
            }
    ?
    d
    • 2
    • 7
  • k

    kpgalligan

    07/23/2019, 3:53 AM
    Using inline classes with expect doesn’t let me use
    val
    with “Inline class cannot have properties with backing fields”, even if all implementations provide getters. Is there a way to do this? Next step is to try the vals as extensions.
    -.kt
    :youtrack: 5
    r
    • 2
    • 6
  • p

    Patrick Jackson

    07/23/2019, 11:31 PM
    Anyone know what happened to KotlinxSerializer in Ktor 1.2.2? Previously I could do:
    HttpClient {
          install(JsonFeature) {
               serializer = KotlinxSerializer()
    But after updating the KotlinxSerializer class is not found
    r
    o
    s
    • 4
    • 4
  • l

    leandro

    07/24/2019, 8:44 AM
    Has anyone already written a multiplatform, flow-based sharedpreferences/userdefaults?
    g
    l
    • 3
    • 5
  • f

    Fail

    07/24/2019, 10:01 AM
    How? Error is here:
    ...
      iosX64("ios") {
            binaries {
                framework {
                    freeCompilerArgs.add("-Xobjc-generics")
                }
            }
        }
        sourceSets {
            commonMain {
                dependencies {
    ...
    s
    • 2
    • 2
  • p

    Patrick Jackson

    07/24/2019, 2:21 PM
    Running into a "Cyclic dependency in library graph" error while compiling, even though it does not appear to be a cyclic dep. I have lib A and lib B. Both are published KMP artifacts. B depends on A. My project depends on A & B. The cyclic dep error happens for lib B. Only happens for native. JVM compiles fine. Any ideas?
    a
    a
    • 3
    • 4
  • f

    Fail

    07/24/2019, 2:23 PM
    Friends. Collecting multiplatform. I do everything on this link: https://kotlinlang.org/docs/reference/native/cocoapods.html In principle, all the rules, the library was assembled, POD was exported. But when it connected to the Xcode project - I see errors:
    Undefined symbols for architecture x86_64:
      "_sqlite3_bind_text16", referenced from:
          _SQLiter_SQLiteStatement_nativeBindString in app(combined.o)
      "_sqlite3_bind_int64", referenced from:
    .....
    Solved🎉
    k
    • 2
    • 13
  • j

    Jan Stoltman

    07/25/2019, 7:30 AM
    Quick question, is there any K/Mp implementation of WeakReference?
    :yes: 1
    🤔 1
    ➕ 1
    d
    k
    l
    • 4
    • 10
  • y

    yshrsmz

    07/25/2019, 8:55 AM
    Any way to use inline classes from Swift? I'm thinking about using inline classes for SQLDelight's primary key. However, it looks like inline classes are not visible from Swift, and are converted to Any if it appears as a method parameter. So my first idea is to use interface, but according to the Kotlin document, inline classes remain wrapped if it is represented as interface.
    kotlin
    // all API surface uses this interface
    interface SomeId
    
    inline class SomeIdImpl(val value: String): SomeId
    I'm wondering if I should stick to primitives.
    s
    • 2
    • 2
  • f

    Fail

    07/25/2019, 10:03 AM
    Friends help me please. When I build application to iOS emulator then all correct and work. But if build for device then build failed with error that all my classes unresolved.
    ...
    Unresolved reference: HttpClient
    Unresolved reference: Job
    Unresolved reference: HttpRequestBuilder
    Unresolved reference: io
    ...
    > Task :app:linkDebugFrameworkIos_32 FAILED
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:linkDebugFrameworkIos_32'.
    > Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
    What wrong? Solved 🎉
    d
    a
    • 3
    • 7
  • c

    carlos cdmp

    07/25/2019, 11:08 AM
    Hi. anyone has solved the problem of swift having mutation errors when using kotlin objects?
    j
    k
    • 3
    • 5
  • k

    Kris Wong

    07/25/2019, 1:51 PM
    is it documented anywhere which iOS SDK classes there are built-in bindings for?
    d
    r
    • 3
    • 8
  • k

    Kris Wong

    07/25/2019, 2:33 PM
    so based on this: https://github.com/JetBrains/kotlin-native/blob/master/platformLibs/src/platform/ios/UIKit.def, in theory it should be possible to assemble a simple UIViewController in an iOS source set?
    o
    • 2
    • 3
  • p

    Patrick Jackson

    07/25/2019, 4:22 PM
    anyone dealt with "Could not build Objective-C module 'shared'" in iOS project? shared is my kotlin module. Have the framework added and get this when I try to import the module. I get this error in common.h:
    Cannot find protocol declaration for 'CommonKotlinCoroutineContextElement'; did you mean 'CommonKotlinCoroutineContextKey'?
    • 1
    • 2
  • k

    Kris Wong

    07/25/2019, 6:01 PM
    has anyone figured out how to
    apply plugin: 'kotlin-android'
    in a MPP library?
    m
    • 2
    • 8
  • p

    Patrick Jackson

    07/25/2019, 9:42 PM
    Anyone have success with the kotlin xcode plugin? I install it and load the bundle, then xcode immediately closes. It does not seem to be loaded when I reopen. There is no syntax highlighting/ breakpoints.
    k
    • 2
    • 67
  • g

    gumil

    07/26/2019, 8:20 AM
    Are there best practices on when to use expect/actual or sometimes we can just use interfaces?
    t
    • 2
    • 1
  • f

    Fail

    07/26/2019, 10:43 AM
    Hi friends! Why breakpoints not working in inline functions? function "subscribe" worked but not stopped. In first picture breakpoint not worked. At next picture not worked too
    t
    o
    k
    • 4
    • 6
  • p

    Patrick Jackson

    07/26/2019, 1:45 PM
    I may have found a bug with kotlin native. I have the following:
    type alias Bar = (String) -> Any
    fun test(foo: Any) {
        if (foo is Function<*>) {
             (foo as Bar)("test")
        }
    }
    On JVM the conditional will be true when passing in a function. On Native it is false.
    o
    • 2
    • 3
  • n

    Nicholas Bilyk

    07/26/2019, 3:19 PM
    For Kotlin multiplatform projects, what's the correct way to access test resources from a test class? The working directory seems to most of the time be the project directory, although that doesn't seem to be the case when running via drone.io. I tried javaClass.getResource methods but that seems to only list class directories, not resource directories.
    k
    • 2
    • 11
  • k

    kpgalligan

    07/26/2019, 3:31 PM
    -.groovy
    k
    l
    • 3
    • 12
  • j

    Jan Stoltman

    07/27/2019, 8:42 PM
    I'm trying to parse a Json in a backthread on native using kotlinx.serializer, but it fails with InvalidMutability exception. it used to work just fine with kotlin 1.3.30 and serialization 10.0 but fails at 1.3.41/11.1. Do you guys know if anything important changed in serialization between these two versions?
    s
    o
    • 3
    • 4
  • e

    egorand

    07/28/2019, 7:08 PM
    Has anybody had problems building multiplatform projects with Java 11? For some reason Gradle fails to resolve project dependencies properly, it works fine with Java 8. For more context, here’s the issue that I’m investigating: https://github.com/square/wire/issues/1081
    d
    • 2
    • 5
Powered by Linen
Title
e

egorand

07/28/2019, 7:08 PM
Has anybody had problems building multiplatform projects with Java 11? For some reason Gradle fails to resolve project dependencies properly, it works fine with Java 8. For more context, here’s the issue that I’m investigating: https://github.com/square/wire/issues/1081
d

Dominaezzz

07/28/2019, 8:23 PM
iirc, native doesn't support that jdk version yet.
I'm looking for some documentation to back that.
To run Kotlin/Native compiler JDK 8 or Java 9 or Java 10 (JDK) for the host platform has to be installed. Produced programs are fully self-sufficient and do not need JVM or other runtime.
https://github.com/JetBrains/kotlin-native/blob/bf7040a119c77b7a5128e5ed40d0b749eb098e77/RELEASE_NOTES.md#compatibility-and-features
Then again. https://github.com/JetBrains/kotlin-native/issues/2943
e

egorand

07/28/2019, 9:48 PM
Interesting, thanks!
View count: 5