https://kotlinlang.org logo
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
  • d

    darkmoon_uk

    08/09/2019, 2:58 PM
    Has anyone found a solution yet to including the
    java
    and
    android
    plugins in the same multi-platform project? Not being able to have targets for android and javafx desktop co-existing in my multi-platform client modules is really cramping my style... I think a code change is probably necessary in the
    android
    plugin to prevent it misbehaving in the presence of the
    java
    one.
    d
    m
    • 3
    • 4
  • r

    Ricardo Meneghin

    08/09/2019, 3:03 PM
    Hello, I'm having a hard time upgrading my project to kotlin 1.3.41 from 1.2.31. I have a multiplatform library that contains all my project's models, and several other modules that depend on it. I'm trying to add the library as a dependency to my other modules. Currently i'm adding two lines like: implementation project (":models-library") implementation "my.group:models-library-jvm:$version" However I'm running into two problems: 1 - transitive dependencies aren't being resolved; models-library depends on several libraries and I get a bunch of "unresolved reference" errors when compiling other modules; 2 - Currently I have to manually run "publishToMavenLocal". Could anyone help me?
    d
    • 2
    • 8
  • k

    Kirill Zhukov

    08/09/2019, 6:55 PM
    👋 I’m trying to specify jvm target for a Kotlin mpp dependency, my original error is this:
    Execution failed for task ':protos:kaptKotlin'.
    > Could not resolve all files for configuration ':protos:_classStructurekaptKotlin'.
       > Could not resolve com.squareup.wire:wire-runtime:3.0.0-rc01.
         Required by:
             project :protos
          > Cannot choose between the following variants of com.squareup.wire:wire-runtime:3.0.0-rc01:
              - jvm-api
              - jvm-runtime
              - metadata-api
            All of them match the consumer attributes:
              - Variant 'jvm-api' capability com.squareup.wire:wire-runtime:3.0.0-rc01:
                  - Unmatched attributes:
                      - Found org.gradle.status 'release' but wasn't required.
                      - Found org.gradle.usage 'java-api-jars' but wasn't required.
                      - Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
              - Variant 'jvm-runtime' capability com.squareup.wire:wire-runtime:3.0.0-rc01:
                  - Unmatched attributes:
                      - Found org.gradle.status 'release' but wasn't required.
                      - Found org.gradle.usage 'java-runtime-jars' but wasn't required.
                      - Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
              - Variant 'metadata-api' capability com.squareup.wire:wire-runtime:3.0.0-rc01:
                  - Unmatched attributes:
                      - Found org.gradle.status 'release' but wasn't required.
                      - Found org.gradle.usage 'kotlin-api' but wasn't required.
                      - Found org.jetbrains.kotlin.platform.type 'common' but wasn't required.
    It seems to be caused by Kotlin annotation processor bug (https://youtrack.jetbrains.com/issue/KT-33206). As a workaround creating custom configuration and setting usage attribute for it works:``` configurations { wire { attributes.attribute(Usage.USAGE_ATTRIBUTE, getObjects().named(Usage, Usage.JAVA_RUNTIME)) } } dependencies { wire deps.wire.runtime } ``` However, originally this dependency is transitive and I need it to keep it this way. How would I do that?
    • 1
    • 5
  • k

    kpgalligan

    08/09/2019, 8:49 PM
    Little tutorial for the super first-timers https://twitter.com/TouchlabHQ/status/1159929312147124224?s=20
    🎉 3
    • 1
    • 1
  • m

    mbonnin

    08/10/2019, 7:50 PM
    How do I easily tell if a depency supports gradle metadata or if I need to add the declaration for each sourceSet ? For an exemple, does
    kotlinx-io
    support meta data ?
    • 1
    • 3
  • w

    wuseal

    08/11/2019, 4:48 AM
    I have an issue when build mpp project to IOS Framwork :
    > Task :mpplib:cinteropAFNetworkingIosX64 FAILED
    e: Could not find "ktor-http-cio" in [/Users/wuhaibao/IdeaProjects/Idle/iosApp/Pods, /Users/wuhaibao/.konan/klib, /Users/wuhaibao/.konan/kotlin-native-macos-1.3.1/klib/common, /Users/wuhaibao/.konan/kotlin-native-macos-1.3.1/klib/platform/ios_x64].
    Anybody could give me some tips?😕 My Gradle Config show as next follow
    Kotlin MPP Gradle config
    d
    • 2
    • 8
  • a

    Akram

    08/11/2019, 12:27 PM
    Hello guys , hope you are doing okey . So i'm working on a multiplatform app with kotlin mpp , and coming from an android background i used to use the mvi pattern so just want to know if there is a way to implement it in kotlin mpp
    j
    a
    • 3
    • 9
  • r

    russhwolf

    08/12/2019, 2:19 AM
    Anyone have any favorite ways of discovering multiplatform dependencies? Will thread some of the resources I’m aware of.
    👍 7
    d
    s
    +2
    • 5
    • 10
  • d

    darkmoon_uk

    08/12/2019, 12:31 PM
    When performing a stand-alone Gradle
    build
    of a multi-platform module; it is natural that all variants are built. ✅ When including a multi-platform module as a project dependency, it's a reasonable default that all variants are built - since one expects any modules overall integrity to be verified in the build process. ✅ But as a heavy optimisation, wouldn't it make sense to have an easy option to build only the platform variant that's demanded by the project inclusion ❓
    i
    • 2
    • 1
  • p

    Patrick Jackson

    08/12/2019, 6:16 PM
    Anyone know current state of using lambas with a return value of Unit in native? Currently in swift I have to always return a KotlinUnit() from a lambda. I've seen an open issue. Has this changed, or will this change in future versions of KN? i.e. to pass a lamda to a Kotlin function we must do:
    myKtFun { dostuff()
        return KotlinUnit() }
    t
    m
    +3
    • 6
    • 18
  • a

    andreasmattsson

    08/13/2019, 7:39 AM
    My IDE (Android Studio) is complaining about
    Overload Resolution Ambiguity
    in the Android app modules of my MPP in cases where the disambiguity appears to only be in "comments" for the resolution of typealiases, see example snippet. It compiles fine with gradle, however it would be nice to get syntax highlighting and autocomplete etc on these types... Any suggestions for ways to resolve this?
    Overload resolution ambiguity. All these functions match.
    l
    • 2
    • 25
  • a

    Alan Camilo

    08/14/2019, 2:48 PM
    Hello, is something like buildConfigField with BuildTypes is possible with the Kotlin Multiplatform Project gradle file ? I want to do something similar to this into my Android/iOS shared lib : https://stackoverflow.com/questions/27875748/android-studio-switching-a-url-depending-on-buildtype-used-for-testing-in-deb
    c
    l
    g
    • 4
    • 6
  • f

    Fail

    08/15/2019, 8:47 AM
    Hi all! When I use SqlDelight then how to drop database when application installed? Can it do without migrations?
    m
    • 2
    • 9
  • a

    Andrey Stepankov

    08/15/2019, 10:01 AM
    Hi, all. What is the best practice for organizing the project structure? My project contains Android, iOS, server, web. For example, I'd would like to have separate git repositories for network entities which will be shared between all backends(server) and backend business logic(mobile, web) code.
    g
    m
    d
    • 4
    • 28
  • d

    darkmoon_uk

    08/15/2019, 10:33 AM
    How do you specify the variant of a Kotlin/Multiplatform project dependency to depend on? When there are two similar JVM variants; it must be disambiguated/specified. Tried the form:
    implementation(project(name="someProj", configuration="variantDefault"))
    ...where 'variant' is the name of the variant to use. This does not resolve correctly. Gradle attributes have their own complications. Is there an easier way I'm missing?
    r
    • 2
    • 2
  • a

    Akram

    08/15/2019, 9:25 PM
    Hey guys , any updates on multithreading with kotlin/native
    ➕ 1
    d
    • 2
    • 2
  • d

    darkmoon_uk

    08/15/2019, 10:31 PM
    Surprised that #multiplatform fans aren't more affected by this related family of issues in IntelliJ/Android Studio Gradle Integration: https://youtrack.jetbrains.com/issue/KT-30390 https://youtrack.jetbrains.com/issue/KT-32814 https://youtrack.jetbrains.com/issue/KT-30912 ...the IDE 'breaks' if you depend on a Multiplatform project from a JVM project, when there is an Android target in the dependency. If this is your use-case now or in the future; consider showing these issues some voting ❤️.
    ✔️ 1
    ➕ 1
    👍 1
    l
    m
    s
    • 4
    • 17
  • s

    saket

    08/16/2019, 2:34 AM
    Has anyone come across a usecase where the actual declarations have to be of different types on different platforms?
    // Kotlin Native
    expect class Feature
    
    // Android
    actual typealias Feature = AndroidFeature
    where AndroidFeature is a class
    
    // iOS
    actual typealias Feature = iOSFeature
    where iOSFeature is an interface
    j
    k
    • 3
    • 28
  • p

    ptmt

    08/16/2019, 9:04 AM
    What’s the approach to “unused” public APIs if you are only using them from Swift? Just suppress all those warnings? Or some custom annotation for
    @DontTouch
    so your colleagues won’t delete them during refactoring?
    l
    • 2
    • 1
  • a

    Alex

    08/16/2019, 10:24 PM
    Does anyone has an implementation of the Base64 encoder/decoder for multiplatform?
    s
    t
    j
    • 4
    • 6
  • d

    Dominaezzz

    08/17/2019, 11:02 AM
    Is there a ticket for
    suspend
    tests?
    t
    • 2
    • 2
  • e

    Evan R.

    08/19/2019, 12:59 AM
    If I’m using a gradle script with the kotlin DSL, how can I build an executable JAR file? I can’t seem to get the application plugin to build the way I want it to
    d
    b
    m
    • 4
    • 11
  • d

    darkmoon_uk

    08/19/2019, 9:55 PM
    Hit again by:
    The 'java' plugin has been applied, but it is not compatible with the Android plugins.
    ...while trying to make an Multiplatform library with an Android and JavaFX target. The OpenJfx plugin putting a dependency on the Java
    application
    plugin is causing it, in this file: https://github.com/openjfx/javafx-gradle-plugin/blob/master/src/main/java/org/openjfx/gradle/tasks/ExecTask.java This means it is not a trivial fix 😕 The crux of the issue is the way the Android Plugin refuses to execute in the presence of the
    java
    plugin; I can see two routes to go here: 1) Make a PR vs the OpenJfx project to make the plugin it adheres to for execution more configurable. 2) Deal with the Android Plugin head on - while this seems like the more daunting task, as there may be deeper issues, @abreslav left a curious comment against a similar issue report, here: https://discuss.kotlinlang.org/t/kotlin-android-gradle/789 "Since Andriod's Gradle is rather peculiar, we have to essentially build a separate Gradle plugin for Kotlin on Android. We are working on it, you can contribute if you feel like it." ...which suggests JB may have considered this back in '13, but the exclusion problem persists.
    l
    a
    +2
    • 5
    • 12
  • k

    Kris Wong

    08/20/2019, 9:05 PM
    how are folks setting up an aggregate fat framework project as an umbrella for all their kotlin MPP modules on iOS?
    b
    • 2
    • 7
  • c

    CLOVIS

    08/21/2019, 4:03 PM
    If I understand correctly, to publish a Multiplatform library, you need to: Enable Gradle Metadata. That creates an additional publication (JAR?) that doesn't contain any artifact, but instead contains links to all variants (JVM, JS...). Publish that to jCenter, let's call it ‘core’. Now, deploy all other variants to jCenter. When someone says
    api("...:...core:...")
    in their Multiplatform/core scope, the Gradle plugin will understand this is not an actual dependency but rather look at the links, and add for each platform the corresponding variant (if there's one). If I understood correctly, that means I need to deploy: - the ‘core’, I guess to jCenter? - the JVM variant - the JS variant - the Linux, Windows... variants Do they all need to be deployed to the same repository for the plugin to find them? I would expect the JS variant to be deployed to NPM or something similar, and the native variants to be deployed directly to Debian's, Arch's, etc's repos...
    k
    c
    • 3
    • 6
  • c

    CLOVIS

    08/21/2019, 4:07 PM
    Is it possible to ‘override’ the dependencies from a ‘core’ dependency? My library depends on coroutines, so the ‘common’ scope declares a dependency on the Metadata coroutine library—but they also have an Android-specific artifact, so I'd like to have a generic-JVM and an Android-specific artifacts. I understand that far, but I'm not sure how to declare that the Android artifact should depend on the Android-specific coroutine implementation
    k
    • 2
    • 1
  • g

    gumil

    08/22/2019, 11:02 AM
    Is it possible to specify the configuration in multiplatform projects? I have a project with transitive multiplatform dependencies and intellij does not recognize the transitive dependency. transitive dependency -> dependency -> application transitive dependency classes are not resolved in the IDE but compiling it in the command line succeed
    r
    • 2
    • 1
  • k

    Kris Wong

    08/22/2019, 1:16 PM
    Has anyone included a MPP as a subproject in another MPP, with a cinterop dependency?
    d
    • 2
    • 3
  • k

    Kris Wong

    08/22/2019, 3:56 PM
    does anyone know why
    linkerOpts
    in a .def file works fine, and
    linkerOpts
    as specified here does not: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#configuring-binaries
    d
    • 2
    • 2
  • k

    Kris Wong

    08/22/2019, 10:18 PM
    finally got an aggregate multiplatform project setup for all iOS modules
    l
    k
    s
    • 4
    • 7
Powered by Linen
Title
k

Kris Wong

08/22/2019, 10:18 PM
finally got an aggregate multiplatform project setup for all iOS modules
that was quite a pain
l

louiscad

08/22/2019, 10:33 PM
Why was it a pain?
k

Kris Wong

08/22/2019, 10:42 PM
i had to piece together unrelated bits of documentation and 1 example to end up with what I needed. lots of trial and error.
k

Konstantin Petrukhnov

08/23/2019, 6:42 AM
Could you share example projects? I think many people will appreciate it.
👍 4
k

Kris Wong

08/23/2019, 1:41 PM
i'll write a blog post in the near future
s

saket

08/23/2019, 3:22 PM
near ™
k

Kris Wong

08/23/2019, 3:29 PM
yeah I have another blog post to write first
View count: 7