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

    GarouDan

    06/16/2020, 12:56 PM
    Hello, If we publish a kotlin mpp library for bintray, for example, I’ve seen that by default all publications go inside the same folder version (
    js
    ,
    jvm
    ,
    macosX64
    , etc.). But when our client is consuming the library with:
    implementation("com.company:project:1.0.0")
    It cannot be automatically choose the correct one, for example, a jvm gradle kts project does not work with this from my tests. Can we still use this way or need we publish everything separately? If we can use together, how can we do it?
    implementation("com.company:project-jvm:1.0.0")
    implementation("com.company:project-js:1.0.0")
    implementation("com.company:project-macos_x64:1.0.0")
    a
    l
    +2
    • 5
    • 20
  • p

    Peter Hsu

    06/16/2020, 7:51 PM
    Hi all, I have a general question about using libraries. I have a project that exports to iOS, Android, and JS. I needed to pull apollo-graphql into my project. Apollo-graphql only supports iOS and Android at this time. Since there is no JS support, I'm unable to add the library dependency to the "common" sourceSets, so I'm unable to share that work for iOS and Android within my project.. It seems like I could create a separate project/repository that exports the iOS/Android artifacts that I need, but that's pretty heavyweight. Is there a better way to accomplish what I want?
    k
    • 2
    • 11
  • p

    Pablo Caviglia

    06/16/2020, 9:52 PM
    Hi, I'm trying to compile a kotlin mp project and to use actual/expect, but when I try to compile with gradle I get this:
    > Task :android:compileDebugKotlin FAILED
    e: /home/pablo/devel/projects/tool_framework_multi_platform/src/androidMain/kotlin/com/senaptec/toolframework/ui/Video.kt: (3, 1): The feature "multi platform projects" is experimental and should be enabled explicitly
    I've added some extra options for the compiler in my build.gradle, but seems to dont have any effect on the error:
    d
    c
    • 3
    • 5
  • m

    Mananpoddarm

    06/17/2020, 7:02 AM
    Hi everyone. Does kotlin multiplatform provide a way to load a .json file? right now, I am sending the .json file as an argument from my android project and it works but it will be good if I can remove this dependency and put it solely in kotlin multiplatform.
    t
    a
    • 3
    • 8
  • c

    christophsturm

    06/17/2020, 9:48 AM
    whats the easiest way to start the jvm backend and the js frontend in one gradle task? basically start the jvmRun task in the background and then run the jsRun task. i mean i can do
    ./gradlew jvmRun &
    and then
    ./gradlew jsRun
    but is it possible with just one gradle task?
    • 1
    • 1
  • c

    Christian Sousa

    06/17/2020, 2:16 PM
    Is there any way of doing something like this On common.kt
    expect fun foo(font: UIFont)
    I mean, having some platform specific parameter on the expect? Or do I have to resort to use
    Any
    ? Thanks!
    r
    • 2
    • 22
  • b

    Benjamin Charais

    06/17/2020, 5:42 PM
    Can I set my Android target to output a JAR specifically, since it defaults to AAR?
    k
    • 2
    • 1
  • d

    dazza5000

    06/17/2020, 10:57 PM
    if i am developing a mp plugin that targets android/js/python on windows - what target do I use so it can be called from python running on windows?
    • 1
    • 1
  • t

    Theo

    06/18/2020, 6:44 AM
    I'm looking at integrating a third party dependency that I'd like to be able to call from my Kotlin framework, it currently only exists as an SDK for iOS and Android, I'm wondering what are some approaches you've used to structure something like this, do you just build an expect / actual wrapper around the third party sdk?
    k
    s
    +2
    • 5
    • 7
  • z

    zeugederunity

    06/19/2020, 9:12 AM
    Hello everyone, I'm working on my first mpp project (Commons/JS/JVM) and have some trouble with importing the Webjar generated from the jsMain. How am i supposed to import the Webjar from my jsMain in my jvmMain?
    a
    k
    d
    • 4
    • 14
  • j

    janvladimirmostert

    06/20/2020, 1:30 PM
    it's rather annoying that i can't have both Serializable and JsExport at the same time
    @JsExport
    //@Serializable
    @ExperimentalJsExport
    data class Blah(
        var name: String? = null,
    )
    or
    //@JsExport
    @Serializable
    //@ExperimentalJsExport
    data class Blah(
        var name: String? = null,
    )
    With both of them, i get this error
    e: java.lang.AssertionError: Properties without fields are not supported com.company.Blah.Companion_instance
    👆 1
    s
    • 2
    • 4
  • c

    christophsturm

    06/22/2020, 11:11 AM
    how can i export classes from my common module to javascript?
    @JSExport
    annotation is only available in the js lib
    a
    s
    • 3
    • 4
  • j

    janvladimirmostert

    06/22/2020, 11:48 AM
    is there a Kotlin Multiplatform Date class? The one in https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-date/ says it's supported on JVM, JS and Common, but not seeing anything when I Ctrl+Space in IntelliJ in a Common Module on 1.4 M2
    t
    s
    +3
    • 6
    • 17
  • m

    Mgj

    06/23/2020, 11:45 AM
    I have a multiplatform project (android + ios) which includes a 'commonTest'. How do i run just the common tests on jvm (i.e. not as instrumented platform tests)?
    m
    t
    +3
    • 6
    • 27
  • j

    Jeff

    06/24/2020, 6:55 PM
    Hey! I'm sure this is a simple question but I am unable to fix it. 😔 I imported a multiplatform project from GitHub using Intellij. Intellij doesn't automatically recognize the Gradle configuration. So I have to manually use the terminal for building the project, running the Android app e.t.c 🤔 Intellij handles other multiplatform projects well and I am able to run app and use the Gradle tasks in the window. Can someone help? 🙂
    r
    j
    a
    • 4
    • 12
  • m

    Mananpoddarm

    06/25/2020, 5:05 AM
    Hello everyone, where can I get a detailed info on how the architecture of kotlin multiplatform works. like how exactly does it compile for multiple platforms.
    s
    k
    • 3
    • 2
  • m

    Mgj

    06/25/2020, 1:30 PM
    Many crossplatform tools like Xamarin and React Native have some way of dealing with navigation (going from one screen to another) from the shared/common code - usually by providing a NavigationService either included by the framework or from libraries. Anyone knows about a thing like that for kotlin-multiplatform?
    s
    • 2
    • 7
  • t

    tylerwilson

    06/25/2020, 2:10 PM
    Anybody here been able to add macosX64 to multiplatform library to target catalyst? If so, could you share your build.gradle snippets?
    t
    • 2
    • 4
  • c

    coolcat

    06/25/2020, 3:32 PM
    Can someone explain me something? I am using Kotlin on iOS and trying to implement an MVP architecture. I use a
    WeakReference
    to hold a reference to a View object from Kotlin, to try and avoid memory leaks. But these objects do not seem to get deallocated immediately when they go out of scope. This is annoying for me as I use iOS
    UIViewController
    as the view object, and the expectation is that these will have
    deinit
    called as soon as they are dismissed. I have tried the project
    icerockdev/moko-mvvm
    . In their iOS sample project
    sample6
    , the memory leak does not seem to occur, and the view has
    deinit
    invoked immediately. I have read the
    moko-mvvm
    source code and I think their implementation is the same as mine. I can’t understand this.
    w
    p
    • 3
    • 3
  • s

    streetsofboston

    06/25/2020, 8:30 PM
    @mbonnin A few colleagues and I are creating a project that has a GraphQL server as backend. Currently, the project is for Android and iOS only. Apollo supports KMP for Android and iOS, so this is great! Thank you and your team! 🙂 But thinking about the future: Does Apollo have plans to support JavaScript (or WebAssembly) for KMP as well? If not, would there be an alternative way to support Apollo Client on the KMP-JS target?
    🙌 1
    m
    r
    +2
    • 5
    • 14
  • r

    Rohen Giralt

    06/26/2020, 12:29 PM
    Hey, does anyone have any idea how to use resources (JSON files, images) in common code and have them exported to iOS and Android (or other platforms, too)? It’s possible for me to just store data in custom classes instead of JSON and copy new image assets to each application individually, but I’d rather not do that. If I’m not mistaken, it’s possible to create a dynamic framework on iOS for this, as well as an Android library on Android, so I’d imagine it’d be possible with some custom build.gradle. Do any of you have any experience with this? Thanks!
    k
    m
    s
    • 4
    • 5
  • a

    Arkadii Ivanov

    06/26/2020, 5:59 PM
    I'm trying to create the
    packForXcode
    Gradle task described here. But I'm getting the following error:
    Unresolved reference: targets
    . Basically
    kotlin.targets
    is unresolved here 😞 Do you have any ideas how to solve it?
    a
    j
    r
    • 4
    • 20
  • k

    Kurt Renzo Acosta

    06/27/2020, 9:33 AM
    Does anyone know how to solve this? I'm trying to use Firestore's IgnoreExtraProperties on KMP.
    // Common
    expect annotation class IgnoreExtraProperties()
    
    // Android
    actual typealias IgnoreExtraProperties = com.google.firebase.firestore.IgnoreExtraProperties
    However, when I try to run it, I get a
    This class does not have a constructor
    . I also did this but no luck. Maybe it's because the actual annotation is just an interface?
    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.TYPE})
    public @interface IgnoreExtraProperties {
    }
    Anyway, any help would be greatly appreciated!
    p
    • 2
    • 1
  • a

    andylamax

    06/28/2020, 4:24 PM
    What is the cause of this error? It happens when I am have a multiplatform lib dependency
    > Task :generatePomFileForAndroidReleasePublication FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':generatePomFileForAndroidReleasePublication'.
    > Could not apply withXml() to generated POM
       > More than one variant of project :klock matches the consumer attributes:
           - Configuration ':klock:releaseApiElements' variant android-aidl:
               - Unmatched attributes:
                   - Found artifactType 'android-aidl' but wasn't required.
                   - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
               - Compatible attributes:
                   - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found compatible value 'release'.
                   - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
                   - Required org.jetbrains.kotlin.platform.type 'androidJvm' and found compatible value 'androidJvm'.
           - Configuration ':klock:releaseApiElements' variant android-manifest:
               - Unmatched attributes:
                   - Found artifactType 'android-manifest' but wasn't required.
                   - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
               - Compatible attributes:
                   - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found compatible value 'release'.
                   - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
                   - Required org.jetbrains.kotlin.platform.type 'androidJvm' and found compatible value 'androidJvm'.
           - Configuration ':klock:releaseApiElements' variant android-renderscript:
               - Unmatched attributes:
                   - Found artifactType 'android-renderscript' but wasn't required.
                   - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
               - Compatible attributes:
                   - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found compatible value 'release'.
                   - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
                   - Required org.jetbrains.kotlin.platform.type 'androidJvm' and found compatible value 'androidJvm'.
           - Configuration ':klock:releaseApiElements' variant android-symbol-with-package-name:
               - Unmatched attributes:
                   - Found artifactType 'android-symbol-with-package-name' but wasn't required.
                   - Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
               - Compatible attributes:
                   - Required com.android.build.api.attributes.BuildTypeAttr 'release' and found compatible value 'release'.
                   - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
                   - Required org.jetbrains.kotlin.platform.type 'androidJvm' and found compatible value 'androidJvm'.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at <https://help.gradle.org>
    
    BUILD FAILED in 1s
    14 actionable tasks: 1 executed, 13 up-to-date
    l
    • 2
    • 1
  • p

    Patrick Jackson

    06/29/2020, 7:53 PM
    I've asked in here before, and will again. For those of you publishing libraries that support multiple architectures, is there an easier method other than acquiring access to machines of the support hardware and creating a build? To publish a library for all platforms I will need a mac, windows, and linux on a couple types of hardware. I see there is support for cross-platform compilation in the kotlin/native compiler, however does not seem possible from the multiplatform gradle plugin. Anyone have insight into this and when/if this situation will get better?
    r
    a
    +2
    • 5
    • 20
  • m

    Mgj

    06/30/2020, 9:10 AM
    Why cant you use RxJava with KMP? Im guessing its because of the Schedulers which have no implementation backing for the different target platforms? Seems odd though that i can add it as a dependency, but the namespaces and classes are just not there - an error would be nice
    g
    a
    +2
    • 5
    • 66
  • n

    Nicolas Bourdin

    06/30/2020, 9:22 AM
    Hello, Is it possible to integrate a kotlin native project (otherKnLib) as project dependencies (source folder) in another kotlin native project (common) ?
    - rootProject
    	- app
    	- iOS
    	- common
    		- src
    			- androidMain
    			- commonMain
    			- ...
    		- build.gradle
    	- otherKnLib
    		- src
    			- androidMain
    			- commonMain
    			- ...
    		- build.gradle
    	settings.gradle
    	build.gradle
    I tried to import my lib in the differents sourceSets dependencies in the common module, but I suppose I also have to specify the "target" (common, android, ios) for each sourceSet
    sourceSets {
    	val commonMain by getting {
    		implementation(project(":otherKnLib")
    	}
    
    	val androidMain by getting {
    		implementation(project(":otherKnLib")
    	}
    
    	val iosMain by getting {
    		implementation(project(":otherKnLib")
    	}
    }
    In this case, when i try to build, i got an
    Unresolved reference
    Any idea ? Thanks in advance :)
    a
    r
    • 3
    • 3
  • c

    Carl Hickman

    07/02/2020, 4:47 PM
    I'm about to embark on creating a multiplatform library for ios and Android. I don't want to spin my wheels getting started. I'm worried about running into outdated documentation. Where is the most up-to-date information about getting started?
    k
    l
    e
    • 4
    • 18
  • s

    serebit

    07/02/2020, 5:11 PM
    Are there any other desktop applications built with Kotlin/Native besides my own Wraith Master project? I assume there are, but I can't name any.
    a
    • 2
    • 1
  • s

    saket

    07/02/2020, 5:12 PM
    if yes, I’m building a macOS app: github.com/saket/press
    👍 1
    e
    b
    • 3
    • 4
Powered by Linen
Title
s

saket

07/02/2020, 5:12 PM
if yes, I’m building a macOS app: github.com/saket/press
👍 1
e

edenman

07/03/2020, 1:08 AM
“Press uses custom Views for designing screens instead of Fragments because Fragments are terrible and Views are great” 👏👏👏
👏 1
also i don’t know how I missed Contour but now I’m really jealous that I didn’t start using it on my current project
s

saket

07/03/2020, 1:56 AM
Contour is great. We plan on announcing Contour 1.0 soon.
👍 2
b

Bruno Kongawi

07/04/2020, 9:02 PM
very beautiful project
View count: 4