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

    kpgalligan

    11/26/2018, 2:42 PM
    I have some questions for the JB team with regards to gradle and metadata. On the native side, as far as I know, to publish gradle dependencies we need to use the metadata feature. This is problematic because it is new and not yet stable, so different versions of gradle (and by extension metadata) are incompatible. The concrete manifestation of this is that most examples and as far as I know all JB libraries are published with 4.7. Android gradle 3.3 needs 4.10, which has a breaking version of metadata. It seems that the native side is continuing with the metadata approach (here: https://github.com/JetBrains/kotlin-native/commit/f68f7028b10ce6f8cd195faaee2c78fd8432ddf1), but that that isn't a universal plan (here: https://github.com/Kotlin/kotlinx.coroutines/issues/564#issuecomment-427885994). The ability to publish dependencies in a predictable way is critical for adoption, so I'm wondering about plans in the near term (continued in thread...)
    i
    • 2
    • 7
  • k

    kenkyee

    11/26/2018, 2:53 PM
    Gradle 5.0 was just released too FYI
    :gradle: 4
    👍 2
    k
    • 2
    • 2
  • j

    janvladimirmostert

    11/26/2018, 3:27 PM
    is it possible to publish multiplatform libraries (for example, one that compiles to JS and Native) to mavenLocal ?
    :yes: 1
    r
    • 2
    • 2
  • a

    addamsson

    11/27/2018, 9:32 AM
    Is it possible to generate javadocs pages from multiplatform projects (using
    kotlin-multiplatform
    plugin) using Dokka?
    l
    • 2
    • 1
  • p

    pajatopmr

    11/27/2018, 11:49 AM
    I have a project targeting JVM and Native where I want to “expect” a File and then typealias the actual but I am beginning to think this might not be possible. How might I accomplish my goal of using the name “File” in both common and JVM code?
    t
    i
    +2
    • 5
    • 23
  • b

    benleggiero

    11/28/2018, 3:00 AM
    Kotlin/JVM has
    @Throws
    . Does Kotlin/JS have something like that?
    g
    d
    • 3
    • 13
  • k

    kpgalligan

    11/28/2018, 6:13 PM
    Are there any good tutorials on multiplatform, specifically for native mobile? I'm sort of really deep in the weeds on it, and am trying to bring some of the team up to speed and realizing how much needs to be explained.
    r
    k
    +4
    • 7
    • 22
  • m

    menegatti

    11/29/2018, 1:51 PM
    more specifically, is there a way to get the current system time, such as in
    System.getCurrentTimeMillis()
    ?
    c
    t
    +5
    • 8
    • 12
  • m

    menegatti

    11/29/2018, 5:16 PM
    2nd question of the day... I know I can use ktor as a client for Android and iOS, but what about other native platforms? Maybe have an interface
    Api
    in
    common
    , an implementation of it based on Ktor in
    mobileCommon
    and something else for windows?
    c
    m
    • 3
    • 16
  • m

    menegatti

    11/30/2018, 11:59 AM
    Hey guys, I'm having a bit with issue with adding a kotlinJs module to my project, mostly due to gradle not being able to find dependencies
    • 1
    • 4
  • k

    kevinskrei

    11/30/2018, 5:54 PM
    Hi Friends, new here. I'm an Android dev and I am looking to make some cross platform code work on both iOS and Android. My company has some straight business logic (no platform API's needed) duplicated on both platforms. I took a look at docs and am a bit confused on the different types of projects I need to use (apple framework, dynamic library, etc) as I don't need any UI or platform specific resources. I've tried out the mpp-ios-android sample and it appears that I can debug the native android code in Android Studio but cannot debug the generated iOS framework from xcode. I'm not sure if it's my unfamiliarity with iOS frameworks, I need a different IDE, I'm generating the wrong type of iOS framework from kotlin native (do I need a dynamic library), or its just not possible to debug the generated code? Based on the searching I've done on this thread I'm reading that debugging might not be supported yet? Thank you
    s
    o
    • 3
    • 6
  • p

    pajatopmr

    12/01/2018, 7:42 AM
    I have pushed the initial code for the KFile project, my attempt to provide a library that provides a canonical Kotlin file class for JVM and Native platforms. https://github.com/pajato/KFile
    👍 4
    m
    t
    +3
    • 6
    • 13
  • m

    menegatti

    12/02/2018, 2:13 PM
    I'm trying out a kotlinjs module in a multiplatform project, but am running into
    Module not found: Error: Can't resolve 'common' in (...)
    even though it is properly defined in gradle. Any idea why would this happen?
    l
    • 2
    • 3
  • j

    judrummer

    12/03/2018, 12:49 PM
    Hello guys, I read mpp sample in this url and follow it https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html. But how can I build ios framework to support both arm32 and arm64 in single build?
    s
    t
    • 3
    • 3
  • s

    Sam

    12/03/2018, 6:23 PM
    Is there a workaround for https://youtrack.jetbrains.com/issue/KT-27535 ? I know there are some libraries out there publishing Android aar artifacts.
    h
    r
    j
    • 4
    • 7
  • k

    kevinskrei

    12/04/2018, 12:53 AM
    I'm looking at the tutorials for mpp (https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html) and see that it says KN comes with some pre-imported frameworks to use for iOS. Is there a way to access Android specific resources in this example? It seems that all of the examples I've seen require Android code to be in a separate module like in multiplatform-settings.
    actual fun platformName(): String {
      return "Android"
    }
    import platform.UIKit.UIDevice
    
    actual fun platformName(): String {
      return UIDevice.currentDevice.systemName() +
             " " +
             UIDevice.currentDevice.systemVersion
    }
    s
    r
    • 3
    • 5
  • s

    Steven

    12/05/2018, 6:24 PM
    all i want to do is use a kotlin multiplatform lib on an xcode project. in the tutorial here https://kotlinlang.org/docs/tutorials/multiplatform-library.html they mention “Now check it with the command ./gradlew publishToMavenLocal and you should see a successful build. That’s it, our library is now successfully published and any Kotlin project can depend on it, whether it is another common library, JVM, JS, or Native application.” Can you use a maven dependency on an xcode project? Sorry for noob questions 🙂
    r
    k
    +2
    • 5
    • 8
  • m

    menegatti

    12/05/2018, 9:35 PM
    Guys, I'm trying to generate a iOS framework to be used by Xcode, but when I build, the project stops recognizing coroutines. I created the task defined here https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html#tuning-the-gradle-build-script and my
    common/build.gradle
    file is :
    apply plugin: 'kotlin-multiplatform'
    
    kotlin {
        targets {
            fromPreset(presets.jvm, 'jvm')
            final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
                                  ? presets.iosArm64 : presets.iosX64
    
            fromPreset(iOSTarget, 'iOS') {
                compilations.main.outputKinds('FRAMEWORK')
            }
        }
    
        sourceSets {
            commonMain {
                dependencies {
                    implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
                    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"
                }
            }
    
            jvmMain {
                dependencies {
                    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
                    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
                }
            }
    
            iOSMain {
                dependencies {
                    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
                }
            }
        }
    }
    s
    • 2
    • 3
  • a

    addamsson

    12/06/2018, 10:03 AM
    Is JetBrains actively working on kotlin2js?
    s
    • 2
    • 2
  • s

    serebit

    12/06/2018, 7:08 PM
    @Test
    fun shouldMatchPath() {
        assertEquals(true, true)
    }
    This common test (in commonTest source set) fails on Kotlin multiplatform 1.3.11. It doesn't run in JVM, and it fails in the linux source set.
    o
    • 2
    • 6
  • s

    serebit

    12/06/2018, 8:24 PM
    Is there any way to actually see the output of native-run tests? No results for linux appear in my build directory, only for jvm
    p
    • 2
    • 2
  • o

    orangy

    12/06/2018, 8:30 PM
    📣 multiplatform library sample with testing and publishing (unofficial) https://github.com/orangy/multiplatform-lib It runs tests for jvm, js & native and can publish it to bintray and likely to maven central (didn’t try it myself). Hope it helps you set up your project for testing & distribution. Feel free to ask questions in a thread.
    😍 3
    🤘 3
    🏆 3
    ❤️ 1
    👍 12
    t
    m
    +6
    • 9
    • 20
  • c

    coletz

    12/07/2018, 9:46 AM
    I recall threads have problems with ios, but also coroutines weren't working that great (some month ago)
    v
    t
    k
    • 4
    • 44
  • s

    serebit

    12/08/2018, 5:35 AM
    Is there a way to make a common
    posix
    source set that has access to
    platform.posix
    , which both
    macos
    and
    linux
    depend on? Or do I just have to copy-paste everything between the two source sets. Edit: Seems like it's possible, but IntelliJ doesn't seem to like it.
    p
    m
    +2
    • 5
    • 6
  • d

    Dominaezzz

    12/08/2018, 3:31 PM
    I'm having issues resolving this (
    implementation 'org.jetbrains.kotlinx:kotlinx-io:0.1.2-multiplatform-dev-4'
    ) dependency on the common source set but the jvm and native variants resolve just fine. Is that valid or is it called something else?
    s
    • 2
    • 2
  • d

    Dominaezzz

    12/08/2018, 5:52 PM
    Can you have an inline class that wraps a different (private) type on each platform?
    d
    • 2
    • 3
  • s

    serebit

    12/08/2018, 11:23 PM
    If I’ve encountered an issue where test result HTML is not being generated for the linux target in a multiplatform project, should I report it as an issue on Kotlin’s issue tracker, or on Kotlin/Native’s issue tracker?
    o
    • 2
    • 1
  • g

    goncalossilva

    12/09/2018, 2:13 PM
    KClass::isOpen
    is marked as being available in Common: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-class/is-open.html However, when trying to use it in a common test, it fails to compile in (at least) JS and Native. Any clues why? JS:
    Unsupported [This reflection API is not supported yet in JavaScript]
    Native:
    error: unresolved reference: isOpen
    Should this work?
    j
    • 2
    • 2
  • t

    tapchicoma

    12/09/2018, 10:07 PM
    message has been deleted
    h
    • 2
    • 5
  • g

    goncalossilva

    12/11/2018, 4:55 AM
    How do we use cinterop from within the new multiplatform plugin? I assume the documentation here (https://github.com/JetBrains/kotlin-native/blob/master/GRADLE_PLUGIN.md) no longer applies?
    g
    • 2
    • 5
Powered by Linen
Title
g

goncalossilva

12/11/2018, 4:55 AM
How do we use cinterop from within the new multiplatform plugin? I assume the documentation here (https://github.com/JetBrains/kotlin-native/blob/master/GRADLE_PLUGIN.md) no longer applies?
g

gildor

12/11/2018, 4:57 AM
This documentation not for kotlin-multiplatform plugin, but for standalone K/N plugin
See this https://discuss.kotlinlang.org/t/kotlin-1-3-m2-new-multiplatform-projects-model/9264
all samples and documentation for this plugin are separate
cinterop example https://github.com/h0tk3y/k-new-mpp-samples/tree/master/native-cinterop
❤️ 1
g

goncalossilva

12/11/2018, 5:01 AM
This is great, thanks! After posting I also found it right at the bottom of the mpp docs: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html Huh, sorry for the dumb question. 🤦‍♂️
View count: 3