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

    pardom

    04/09/2019, 7:26 PM
    Is anyone aware of a current list of libraries supporting MPP (e.g. Okio, SQLDelight, Ktor)?
    s
    i
    +2
    • 5
    • 18
  • n

    Nikolai

    04/10/2019, 4:48 AM
    Hello, everyone What is the best way to debug app.framework (library generated for iOS part). I call method of one of the common classes from iOS sources and after that - nothing. Just output in XCode debug panel. I see kotlin.TypeCastException, but I don’t understand there it happend and what action caused it. I tried to add try/catch block inside common class method, but nothing changed.
    o
    i
    • 3
    • 4
  • t

    Tobi

    04/10/2019, 7:30 AM
    Hello folks, I am currently working on a multiplatform library, targeting jvm and native, involving some hashing. For that I need a
    ByteArray
    representation of a
    String
    , but just realised that
    String.toByteArray()
    (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-byte-array.html) is just available on the jvm 😞 Any suggestion how I can do this in the common part?
    a
    • 2
    • 24
  • r

    ribesg

    04/10/2019, 8:29 AM
    Is there an easy way to publish the sources of a MPP project for Android? The sources are available in IntelliJ when using the iOS lib but not when using the Android one
    l
    • 2
    • 14
  • m

    matej

    04/10/2019, 2:54 PM
    I think I'm missing something, but how can I use the
    presets.android
    target preset with the project structure as they describe it at https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html? I would have to apply the
    com.android.application
    plugin in the build.gradle inside SharedCode, but that's no good because then Android Studio starts expecting to find an AndroidManifest file there etc. etc.
    d
    • 2
    • 8
  • m

    matej

    04/10/2019, 3:23 PM
    Makes sense. On the other hand, the very same official example uses iOS classes to obtain the device info, and then in the Android section they just return a string
    Android
    😄 which nicely circumvents having to deal with all of that but can lead to quite some confusion as you say. I guess we just have to live with the fact that for now a lot of things are in flux and documentation is lacking, but it is improving constantly.
    o
    • 2
    • 2
  • d

    Dennis L

    04/10/2019, 7:00 PM
    Is there any pure Kotlin Multiplatform DB/ORM libraries besides sqldelight? Something involving writing less SQL statements, I'm guessing it's the only one for now?
    k
    g
    t
    • 4
    • 9
  • y

    yshrsmz

    04/11/2019, 2:29 AM
    Is it possible to change the name of wrapper object of top level functions? If I define
    fun calculate():Int
    in
    Util.kt
    , We have to call it like
    UtilKt.calculate()
    in Swift but I want
    Util.calculate()
    . In jvm we have
    @JvmName
    , but in native I can't find the equivalent
    s
    s
    • 3
    • 5
  • l

    Lawik

    04/11/2019, 8:09 AM
    Does anyone know how to apply something similar to this when the expected annotation class has a parameter?
    -.kt
    t
    • 2
    • 2
  • n

    Nikolai

    04/11/2019, 10:03 AM
    Hi, eveyone Is where any multiplatform Base64 library? Or maybe where is a way to convert string to NSString? I need to encode string with base64 in actual class for iOS platform
    o
    s
    +4
    • 7
    • 14
  • l

    Lawik

    04/11/2019, 11:04 AM
    When I annotate an expected class in my common code, the annotation is removed from the compiled jvm class, is there any way to prevent this?
    l
    • 2
    • 4
  • g

    galex

    04/12/2019, 6:22 AM
    Hello, I am trying to “multiplatform” the ViewModel class from androidx:
    public abstract class ViewModel {
        protected void onCleared() {
        }
    }
    I hoped the following would work:
    expect abstract class ViewModel {
         protected fun onCleared()
    }
    And on Android declare it this way:
    actual typealias ViewModel = androidx.lifecycle.ViewModel
    But because protected means different things in Kotlin and Java, I get the following error:
    protected final expect fun onCleared(): Unit
    is incompatible because visibility is different from
    protected/*protected and package*/ open fun onCleared(): Unit
    . Am I stuck here or is there a way to go around this?
    y
    r
    • 3
    • 3
  • r

    Riccardo Montagnin

    04/12/2019, 7:43 AM
    Hello everyone! I'm trying to publish a Kotlin multiplatform library to Maven. I only have the common module for now, and I would like to publish it so that it is available for all platforms. How should I do this? I see that I have two project types:
    metadata
    and
    kotlinMultiplatform
    . Which one should I publish with with name? Thanks in advance
    g
    • 2
    • 5
  • l

    louiscad

    04/12/2019, 1:12 PM
    Hi, is
    enableFeaturePreview("GRADLE_METADATA")
    still needed for Multiplatform projects on Gradle 5.3.1, where gradle metadata is stable?
    j
    h
    r
    • 4
    • 4
  • i

    Icaro Temponi

    04/12/2019, 2:54 PM
    Is there a way to publish only 1 source set using bintray publish?
    h
    • 2
    • 2
  • h

    Hauke Radtki

    04/12/2019, 3:00 PM
    Is there a Gradle Plugin for Multiplatform BuildConfig generation?
    • 1
    • 1
  • c

    Casey Brooks

    04/12/2019, 3:38 PM
    I’m having trouble understanding the Kotlin/Native global immutability model, specifically for an iOS/Android shared library. I basically want to do a one-time initialization on a singleton to register an API key, and the only way I could get the iOS tests to pass was by using
    @ThreadLocal
    on the companion object and
    @SharedImmutable
    on the value to be initialized once. But that
    @ThreadLocal
    annotation makes me think that another thread might try to access the shared object and have it not be there, does the
    @SharedImmutable
    mean that each thread-local companion object will reference the same API key after initialization? Here’s basically what I’ve got
    class SingletonConfiguration
    private constructor(
        val apiKey: String
    ) {
    
        @ThreadLocal
        companion object {
            @SharedImmutable
            lateinit var instance: SingletonConfiguration
    
            fun init(apiKey: String) : SingletonConfiguration {
                instance = SingletonConfiguration(apiKey)
                return instance
            }
        }
    }
    d
    k
    • 3
    • 21
  • d

    Dennis L

    04/14/2019, 5:44 PM
    Would be in the future to have some sort of basic cross platform string resource you can write to that then exports out the common strings to the platform targets (if they have their own standard string file formats or something easy to use for the platforms that don't like JS (with the option to override and have platform specific strings too as needed
    👍 1
    s
    • 2
    • 1
  • r

    russhwolf

    04/14/2019, 6:09 PM
    @orangy Any plans to update https://github.com/orangy/multiplatform-lib to gradle 5.3? I’ve been having trouble figuring out the right changes I need to make on the JS side in gradle 5.x and haven’t been able to find a good up-to-date library publishing sample.
    ➕ 1
    o
    • 2
    • 3
  • t

    Tobi

    04/14/2019, 8:14 PM
    Hey folks, I am currently working on a multiplatform library including some hashing and need to migrate a hmac-sha-256 function to pure kotlin. Any suggestions on how to this? Could I use KHash (https://github.com/komputing/KHash) to do that? cc @Riccardo Montagnin
    o
    r
    • 3
    • 3
  • b

    basher

    04/14/2019, 9:43 PM
    I'm having trouble setting the jvm target for an android library (using the
    com.android.library
    plugin) in my mpp project:
    kotlin {
        targets {
            targetFromPreset(presets.android, 'android') {
                compilations.main {
                    kotlinOptions {
                        jvmTarget = "1.8"
                    }
                }
            }
        }
    }
    Saying it can't find the
    main
    method for compilations. is there somewhere else I should be setting the JVM target?
    • 1
    • 1
  • s

    Steven

    04/15/2019, 2:48 PM
    speaking of 1.3.30, i can't get my project to work with ktor 1.1.3 from the moment i updated kotlin 1.3.30. I think there may be a compat issue
    d
    s
    +2
    • 5
    • 10
  • c

    czuckie

    04/15/2019, 7:44 PM
    can anyone help me add a cinterop library to a kotlinscript gradle multiplatform project in CLion?
    • 1
    • 1
  • k

    Kaden Wilkinson

    04/15/2019, 8:27 PM
    Seems to blow up when my multiplatform library includes
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version
    and my app does as well. Fails with
    Plugin request for plugin already on the classpath must not include a version
    d
    d
    h
    • 4
    • 6
  • k

    Kris Wong

    04/15/2019, 9:37 PM
    looks like the new cocoa pods plugin expects certain configurations names: "No enum constant org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.SECUREDEBUG"
    i
    • 2
    • 7
  • n

    Nikky

    04/16/2019, 3:32 AM
    does anyone have a sample mpp project with
    application
    and ShadowJar for packing the jvm target ?
    d
    • 2
    • 2
  • r

    ribesg

    04/16/2019, 8:27 AM
    I think I found an IDE bug. On a boolean value passed as argument to an
    expect
    function I get the
    Boolean literal argument without parameter name
    warning, but named arguments are not allowed for members of expected classes
    g
    • 2
    • 4
  • d

    Dmitry Motyl

    04/16/2019, 11:56 AM
    For cocoapods plugin can we set additional export frameworks?
    k
    h
    i
    • 4
    • 21
  • j

    JoakimForslund

    04/16/2019, 1:16 PM
    Am I missing something here, trying to use cocoapods + the new 1.3.30 spec but both:
    println("DEVICE: ${project.findProperty("kotlin.native.cocoapods.target")}")
    and
    println("DEVICE: ${project.findProperty("device")}")
    returns null in the build script, is this because me using kotlin script instead of groovy now?
    s
    • 2
    • 6
  • d

    Dmitry Motyl

    04/16/2019, 3:38 PM
    What is the situation with xml parsing? Only platform specific parsers ?
    r
    d
    • 3
    • 2
Powered by Linen
Title
d

Dmitry Motyl

04/16/2019, 3:38 PM
What is the situation with xml parsing? Only platform specific parsers ?
r

r4zzz4k

04/16/2019, 4:56 PM
There is an external XML for kotlinx.serialization: https://github.com/pdvrieze/xmlutil Unfortunately, it doesn't seem to support native targets, so there is an awesome opportunity to contribute 😉
d

Dominaezzz

04/16/2019, 5:28 PM
You could try libxml2
View count: 6