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

    nestserau

    11/13/2018, 2:24 PM
    According to documentation,
    kotlin-stdlib/kotlin.native/toUtf8
    should be available on String in my multiplatform project. But I cannot invoke it. Intellisense doesn’t see that method. What am I doing wrong?
    d
    • 2
    • 3
  • g

    GarouDan

    11/13/2018, 7:22 PM
    Hi guys, If we would like to have the common source sets with different names, how could we do it? Is there something that we can put in our build.gradle? For example
    commonMain,
    commonTest,
    jvmMain,
    jvmTest,
    jsMain,
    jsTest
    to
    main,
    test,
    jvmMain,
    jvmTest,
    jsMain,
    jsTest
    h
    • 2
    • 2
  • g

    GarouDan

    11/13/2018, 8:51 PM
    Taking advantage of this opportunity @addamsson, do you know where can I find the documentation of the kotlin-multiplatform plugin (to see all possibilities we can have in the source sets and presets?
    k
    a
    • 3
    • 5
  • g

    GarouDan

    11/14/2018, 1:57 AM
    One another doubt of mine is, can we have more than one common source set in the same module? For example, this way we could have an expect class statement just for a specific business domain, like the mobile one. If we put the expect in the common source set the js platform, for example, will need to implement this too. Putting this information on a different source set we could use something like depends on to accomplish that. I know that this problem can be solved with two or.more modules but I was wondering if we can do that in the same module too.
    k
    h
    • 3
    • 5
  • a

    addamsson

    11/14/2018, 8:27 AM
    but JB is definitely working on this
    n
    • 2
    • 2
  • p

    patjackson52

    11/14/2018, 10:12 PM
    Anyone interested in showing Timber some MPP love? I’ve created a WIP PR to refactor to the new MPP plugin. Still needs a lot of work overall to get it into proper shape. Would be nice to have easy logging with the familiar API on iOS & Android. Comments are welcome… https://github.com/JakeWharton/timber/pull/341
    k
    l
    +3
    • 6
    • 55
  • e

    egorand

    11/14/2018, 10:53 PM
    how does one add platform-specific 1) plugins 2) tasks using the new multiplatform plugin? I'm trying to setup testing for the JS target using the
    com.moowork.node
    plugin and a bunch of custom tasks and struggling to wrap my head around it
    a
    r
    l
    • 4
    • 8
  • h

    Hamza

    11/15/2018, 3:43 AM
    how can i configure things like compilekotlin2Js in a multiplatform build?
    e
    • 2
    • 3
  • b

    bkenn

    11/15/2018, 5:52 AM
    Check out klock
    😍 1
    k
    j
    • 3
    • 4
  • e

    Eugenio

    11/15/2018, 3:36 PM
    Anyone having trouble with multi-platforms projects and
    1.3.10
    ? I'm getting this: (if it makes any difference, I'm using the Gradle Kotlin DSL)
    > Task :common:compileKotlinCommon FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':common:compileKotlinCommon'.
    > Could not resolve all files for configuration ':common:compileClasspath'.
       > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-common:1.3.10.
         Required by:
             project :common
          > Cannot choose between the following variants of org.jetbrains.kotlin:kotlin-stdlib-common:1.3.10:
              - compile
              - enforced-platform-compile
              - enforced-platform-runtime
              - platform-compile
              - platform-runtime
              - runtime
            All of them match the consumer attributes:
              - Variant 'compile':
                  - Found org.gradle.component.category 'library' but wasn't required.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'kotlin-api' and found compatible value 'java-api'.
                  - Required org.jetbrains.kotlin.platform.type 'common' but no value provided.
              - Variant 'enforced-platform-compile':
                  - Found org.gradle.component.category 'enforced-platform' but wasn't required.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'kotlin-api' and found compatible value 'java-api'.
                  - Required org.jetbrains.kotlin.platform.type 'common' but no value provided.
              - Variant 'enforced-platform-runtime':
                  - Found org.gradle.component.category 'enforced-platform' but wasn't required.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'kotlin-api' and found compatible value 'java-runtime'.
                  - Required org.jetbrains.kotlin.platform.type 'common' but no value provided.
              - Variant 'platform-compile':
                  - Found org.gradle.component.category 'platform' but wasn't required.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'kotlin-api' and found compatible value 'java-api'.
                  - Required org.jetbrains.kotlin.platform.type 'common' but no value provided.
              - Variant 'platform-runtime':
                  - Found org.gradle.component.category 'platform' but wasn't required.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'kotlin-api' and found compatible value 'java-runtime'.
                  - Required org.jetbrains.kotlin.platform.type 'common' but no value provided.
              - Variant 'runtime':
                  - Found org.gradle.component.category 'library' but wasn't required.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Required org.gradle.usage 'kotlin-api' and found compatible value 'java-runtime'.
                  - Required org.jetbrains.kotlin.platform.type 'common' but no value provided.
    r
    h
    s
    • 4
    • 9
  • k

    kpgalligan

    11/15/2018, 5:01 PM
    I'm doing a talk next week at Droidcon SF. Looking to see if there are any new libraries released for multiplatform, and if anybody is going into production in the near future. This is mostly for native mobile, but interested in web and/or other platforms.
    a
    t
    +2
    • 5
    • 8
  • d

    Dico

    11/15/2018, 8:53 PM
    I think I found a bug in the gradle multiplatform plugin. It's related to compiling for native targets. When you have project A that depends on project B, and project B has a cinterop library, the
    linkerOpts
    from its configuration are not included when the target for project A is linked.
    e
    m
    • 3
    • 4
  • a

    addamsson

    11/17/2018, 2:00 PM
    Do you know what is the best practice to hide code from Java / Kotlin users? What I found is
    @JvmSynthetic
    which can be used to hide things from the Java API and the
    internal
    which can be used to hide things from the Kotlin API. My goal is to have idiomatic APIs for both Kotlin and Java users
    t
    • 2
    • 9
  • b

    bdeg

    11/17/2018, 5:20 PM
    Hi, I'm trying to build my first multi platform project using the new multi platform plugin. Before I used to build the platform apps as sub-modules but now it's as sourcesets can someone explain why jetbrains decide to switch to sourcesets and is it possible to still use the new plugin but with the submodule fashion?
    🤔 1
    s
    e
    a
    • 4
    • 14
  • k

    kyonifer

    11/18/2018, 7:40 PM
    is there a way to set the base name used for native targets using new-mpp? looks like
    compilationName
    and
    name
    are read-only. I'm trying to change the default name of the project that gets used throughout the generated
    .h
    file, but changing the project name to something else will affect the other platforms as well
    s
    t
    l
    • 4
    • 7
  • l

    ldavin

    11/19/2018, 9:15 AM
    Hi there. I’m still wondering how things work regarding testing and test running : When I run my multiplatform unit tests on a project with 3 targets (jvm, iosX64 and iosArm64), it’s only really executed on one target (the jvm one). How is it supposed to go ? Why is it not running against my ios targets ? Because it’s a kotlin-native target and running tests currently only works on JVM and JS ? Or is it a normal behaviour (running only on the first target for example) since if it works on one, it should work on all targets ?
    t
    • 2
    • 2
  • h

    hiperbou

    11/20/2018, 2:59 PM
    I'm adding the application plugin to the MPP 1.3.10 template 'Kotlin (JS Client/JVM Server)' and I always get the error "could not find or load main class 'sample.SampleKt' " Is there any example of using the application plugin in a multiplatform project?
    a
    • 2
    • 5
  • k

    Kaden Wilkinson

    11/20/2018, 7:14 PM
    Is it currently possible to depend on 3rd party libraries in a Kotlin Multi-platform library project? e.g. I want to write an auth library that wraps Auth0.swift and Auth0.Android that produces a iOS framework and android jar
    l
    • 2
    • 2
  • s

    serebit

    11/20/2018, 7:16 PM
    oo, not bad @lewik. working on a kotlin logging lib myself
    l
    o
    +2
    • 5
    • 9
  • p

    pajatopmr

    11/21/2018, 2:23 AM
    I’ve been looking for information about the fact that tests in CommonTest that use the idiomatic “fun `test name wrapped in back ticks`()” do not compile in JS (fails with illegal character message). Could this be an unreported bug? Or have I missed an issue or Slack message that addresses the undesirable behavior?
    a
    s
    a
    • 4
    • 3
  • a

    Ana Stu

    11/21/2018, 10:33 AM
    hello! I've developed an Android app in Kotlin with the help of Android Studio, I want to make it available in iOS too, anyone with some experience could tell me how could I get started?
    j
    • 2
    • 2
  • i

    Ivan

    11/21/2018, 11:40 AM
    How to build ios framework from intellij idea generated k/n mpp project? it does not have common module gradle folder and root->build->build ends up with error Process 'command '/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
    o
    t
    • 3
    • 3
  • e

    ehubbard

    11/21/2018, 6:19 PM
    Has anyone tried to use the kotlin-frontend-plugin plugin alongside the multiplatform plugin? I dont' think they were meant to work together...
    j
    h
    h
    • 4
    • 4
  • l

    ldavin

    11/22/2018, 10:07 AM
    Hi there. I’m sorry I have a dumb question to which I cannot find an answer. What’s the artifact signature containing a
    Throws
    annotation that’ll work on a native (ios) target ? I’m thinking of something like
    org.jetbrains.kotlin:kotlin-stdlib-native
    s
    b
    +2
    • 5
    • 14
  • a

    alex.hart

    11/23/2018, 1:24 PM
    Might be an obvious question, but does annotation processing work with kotlin multiplatform or only JVM modules?
    d
    j
    g
    • 4
    • 3
  • j

    josephivie

    11/23/2018, 3:58 PM
    Where should I place generated code in a multiplatform project? I'd like it to be in the build folder (vcs ignore usually covers by default, never have to make a special case), but I'm not quite sure how to add a directory to a source set. I could add a new source set, but that sounds like a bit of a pain due to generated code having the same dependencies as the project.
    h
    • 2
    • 1
  • g

    gabin

    11/23/2018, 8:22 PM
    Hello. I’ve opened a project from tutorial https://github.com/JetBrains/kotlin-examples/tree/master/tutorials/mpp-iOS-Android in Android studio 3.3 and got a sync error. can you help me with it?
    t
    • 2
    • 1
  • g

    gabin

    11/24/2018, 2:58 PM
    Full_stacktrace_of_sync_error__from_previous_message__taken_from_idea_log.lua
    s
    • 2
    • 1
  • a

    addamsson

    11/24/2018, 7:06 PM
    I have installed IDEA 2018.3 and my project is broken ever since. IDEA compalins that
    Compilation is not supported for following modules: zircon.core_commonMain, zircon.core_commonTest, zircon.core_jvmMain, zircon.core_jvmTest. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
    what could be the problem? Gradle build runs fine, the application works, and it worked in the previous IDEA version as well. What do I need to upgrade to get this fixed? I'm not even using Android (have nothing Android-related on my computer). What's really weird is that I have neither non-Gradle Java modules nor Android-Gradle modules!
    r
    o
    p
    • 4
    • 4
  • r

    robstoll

    11/24/2018, 8:34 PM
    I have a multi-platform project with jvm, android and js as target platforms. JVM and Android share the most code though. For instance, a class A defined in the common module as
    expect
    is the same in jvm and android. Is there a way to share the common code only for certain platforms?
    l
    • 2
    • 1
Powered by Linen
Title
r

robstoll

11/24/2018, 8:34 PM
I have a multi-platform project with jvm, android and js as target platforms. JVM and Android share the most code though. For instance, a class A defined in the common module as
expect
is the same in jvm and android. Is there a way to share the common code only for certain platforms?
l

Liliia

11/26/2018, 11:49 AM
There is a bunch of issues for support of such configurations: https://youtrack.jetbrains.com/issue/KT-27801 I believe your case is somewhat close to https://youtrack.jetbrains.com/issue/KT-28194 or https://youtrack.jetbrains.com/issue/KT-27816. Currently, there is no way to do it so the IDE wouldn’t complain, but Gradle builds successfully such configurations as this: https://github.com/wild-lynx/k-new-mpp-samples/blob/master/split-actuals/build.gradle
View count: 4