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

    Marko Novakovic

    08/27/2022, 9:16 AM
    I have KMM app with `ViewModel`s inside shared module. am using Jetpack Compose on Android side, no Compose Multiplatform. since Compose can infer stability of the classes, interfaces etc. just from modules that are actually compiled with Compose compiler, will it help if I import Compose compiler in
    shared
    module or I just move my Android side Jetpack Compose code to
    shared
    module and go full Compose Multiplatform? my state classes are inside
    shared
    module and I can create 1:1 copy of those inside my Android module but I would rather do one of two I proposed
    h
    • 2
    • 11
  • d

    deviant

    08/29/2022, 5:44 AM
    hey guys. is there a lib for playing sounds? i'm making a simple multiplatform game with compose multiplatform. i'd like to play some sounds on android/js/desktop, but i'm too lazy to write expect/actual wrappers 🙂
    p
    g
    m
    • 4
    • 3
  • j

    Jakub Sieprawski

    08/29/2022, 7:28 AM
    Hey, I am developing KMM library named Module A, also i made a messenger module in KMM technology which i want to use in Module A. I generated native packages from messenger module - .aar for android, and .xcframework for ios. When I am adding generated Messenger xcframework to my swift project, everything works fine, i can see contents of the module, but when i am adding it by cInterop to my native code of Module A, it is adding because i am not getting any runtime error but i cannot see its contents, i am getting unresolved reference on every class from Messenger Module. Am i doing something wrong or should i add some annotation to my messanger classes to export them to objc?
    • 1
    • 1
  • g

    Gillian Buijs

    08/29/2022, 12:49 PM
    Is there by any chance someone here who worked on creating the KMM plugin for Android Studio? I'm building my own plugin and using extension point "com.android.tools.idea.wizard.template" but can't figure out how to get the icon in the selection screen look good. I use the Thumb class in a TemplateBuilder and it displays the icon, but it's way too big, hideous etc... The KMM template icon looks great so would love to know how it's done. Can't find it in the docs and haven't found the sourcecode of the KMM AS plugin either... Help me obi-wan...anyone? 😒miling_face_with_tear:
    k
    • 2
    • 9
  • c

    crumpf

    08/29/2022, 2:50 PM
    I've been using the XCFramework gradle task (
    import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
    ) to generate xcframeworks for iOS following the documentation. However, it looks like it only assigns the metadata in the xcframework's info.plist for the bundle's name. Is there an automated way to be able to assign other metadata values in the plist like
    CFBundleVersion
    and
    MinimumOSVersion
    ?
    h
    • 2
    • 1
  • e

    eygraber

    08/30/2022, 7:01 PM
    Do custom test source sets need an explicit dependency on the main source set? Or is there some magic convention with the names that sets it up automatically? e.g. in the following example, is
    dependsOn(appleMain)
    necessary?
    with(sourceSets) {
      val appleMain = create("appleMain") {
        dependsOn(getByName("commonMain"))
      }
    
      create("appleTest") {
        dependsOn(appleMain)
        dependsOn(getByName("commonTest"))
      }
    }
    j
    e
    +3
    • 6
    • 41
  • h

    humblehacker

    08/31/2022, 12:58 AM
    I see plenty of mentions that `fun `backtick in function names`` is not allowed in kotlin-js, but I'm trying to use them in some tests in a KMM project, and it's also failing for iOS while they work fine for Android. I'm pretty sure the answer is going to be the same, that it's not supported. But could someone confirm that for me, or point me to where I can confirm it myself? To be clear, the error I'm getting is not explicitly for the backticks, but rather the spaces and commas.
    j
    e
    g
    • 4
    • 11
  • x

    xxfast

    08/31/2022, 1:50 PM
    Looks like a compiler error - have you identified which piece of code is failing too compile with this error?
    r
    • 2
    • 1
  • a

    Alper Tekin

    08/31/2022, 8:08 PM
    Hi, does anyone have an issue with iOS 12 support of KMM? App crashes after launch. Any idea? Kotlin: 1.6.21, Coroutines: 1.6.1-native-mt Ktor: 2.0.0
    l
    h
    s
    • 4
    • 4
  • j

    jeran

    08/31/2022, 10:49 PM
    hello, does anyone know if the kotlin multiplatform gradle plugin is open source? and if so where i can find it?
    e
    j
    • 3
    • 6
  • p

    Paul Woitaschek

    09/01/2022, 7:51 AM
    Are there any advanced steps possible to reduce the size of the ios / watchos application? What we tried so far: • Move everything into a single gradle module and make everything internal that’s possible • Switching from dynamic to static linking (-1MB) • Not exporting any libraries Maybe some compiler flags that further reduce the size? We are currently blocked by this because the size of the watch (81mb) is larger than what apple allows (75mb)
    p
    h
    +4
    • 7
    • 57
  • d

    Dzmitry Petrushenka

    09/01/2022, 9:59 AM
    Hi Guys! Getting the following error when running my iOS app for KMM on physical device:
    > Task :shared:embedAndSignAppleFrameworkForXcode FAILED
    error: One or more parameters passed to a function were not valid.
    Any idea what it can be?
  • d

    Dzmitry Petrushenka

    09/01/2022, 10:00 AM
    I’m new to iOS and KMM so maybe it is something trivial but googling the problem didn’t give me an answer for now
    • 1
    • 1
  • d

    Dzmitry Petrushenka

    09/01/2022, 11:06 AM
    this is something I was able to grab from Console
    Non-fatal error enumerating at <private>, continuing: Error Domain=NSCocoaErrorDomain Code=260 "The file "PlugIns" couldn't be opened because there is no such file." UserInfo={NSURL=PlugIns/ -- file:///Users/dzmitry/Library/Developer/Xcode/DerivedData/iosApp-dbufieajloitrxfucbgqqibzrzie/Build/Products/Debug-iphoneos/iosApp.app/, NSFilePath=/Users/dzmitry/Library/Developer/Xcode/DerivedData/iosApp-dbufieajloitrxfucbgqqibzrzie/Build/Products/Debug-iphoneos/iosApp.app/PlugIns, NSUnderlyingError=0x7ff4a1abaec0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
  • d

    Dzmitry Petrushenka

    09/01/2022, 11:07 AM
    would be appreciated for any help
  • d

    Dzmitry Petrushenka

    09/01/2022, 11:07 AM
    I do see there is no PlugIns directory in place
  • p

    Paul Woitaschek

    09/01/2022, 3:41 PM
    I wonder if this is blocking an iOS 16 release with kmp: https://youtrack.jetbrains.com/issue/KT-53107/Add-arm64-support-for-watchOS-targets-Xcode-14
    s
    m
    • 3
    • 8
  • s

    Sachinda Liyanaarachchi

    09/01/2022, 5:09 PM
    How can I have a business layer model class that only supports js
    h
    c
    • 3
    • 8
  • j

    jacksonfdam

    09/02/2022, 7:31 AM
    I'm using Koin, but I'm not sure about the best approach to pass the app context until the shared prefs library.
    m
    p
    • 3
    • 11
  • d

    diego-gomez-olvera

    09/02/2022, 2:10 PM
    given that https://github.com/Kotlin/kmm-with-cocoapods-sample is 2 years old, what do you user for reference for your KMP library with Cocoapods?
    j
    • 2
    • 5
  • p

    Peter Hsu

    09/02/2022, 5:05 PM
    I'm running into issues with Android Studio updating to kotlin 1.7.10 with a highly modularized project. it seems like AS gets confused when
    module A/androidMain
    has dependencies on
    module B/commonMain
    . AS has no problems with
    module B/androidMain
    depending on
    module B/commonMain
    c
    • 2
    • 2
  • m

    mattinger

    09/03/2022, 2:06 AM
    I’m sure this has been asked, but i wanted to confirm my suspicions that kotlin-reflect is a jvm only library. I have things i would like to do with meta programming, but i’m not sure i could make that work on iOS code (i’m not targeting JS, just android and ios), Swift itself has the Mirror functionality for reflection, but it’s my understanding that kmm doesn’t really deal in swift and compiles directly to down to binary code.
    t
    e
    • 3
    • 5
  • b

    Big Chungus

    09/03/2022, 2:43 PM
    11 should work just fine, but cfd only needs 9+ for jlink and jpackage
    j
    • 2
    • 2
  • a

    adjpd

    09/04/2022, 11:33 AM
    When Kotlin 1.7.20 is released do we think it'll have support for most of the compiler plugins needed for an average KMM (Android and iOS) project?
  • e

    eygraber

    09/05/2022, 8:21 PM
    I see that Windows can be compiled on any host as of 1.6.0 (https://kotlinlang.org/docs/whatsnew16.html#compilation-of-windows-targets-on-any-host). Would running common tests for a Windows target work, or is it just compilation?
  • b

    Bohdan

    09/05/2022, 8:22 PM
    Hi, I have an issue with pod on ios. I am using some analysis in shared code - and it works fine in code(I am able to use sdk for both platforms via expect/actual) - but when i try to build and test it for iOS i receive error. did anyone face some issue and knows how to fix it?
    l
    • 2
    • 5
  • p

    PHondogo

    09/06/2022, 8:17 PM
    Hello! Is it possible to add several android targets in one project? Now in such case when plugin com.android.library is applied it throws exception that extension with kotlinOptions already defined when defining second android target.
    e
    • 2
    • 1
  • x

    xxfast

    09/07/2022, 3:47 AM
    You are missing the
    iosArm64()
    target
    l
    s
    • 3
    • 14
  • x

    xxfast

    09/07/2022, 4:13 AM
    Hi all. I'm getting this native compiler error
    java.lang.IllegalStateException: IrPropertyPublicSymbolImpl for io.github.xxfast.utils/FILE_SYSTEM|225970167697663469[0] is already bound: PROPERTY name:FILE_SYSTEM visibility:public modality:FINAL [val]
    my build script is setup as
    kotlin {
      val hostOs = System.getProperty("os.name")
      val isMingwX64 = hostOs.startsWith("Windows")
      val nativeTarget = when {
        hostOs == "Mac OS X" -> macosX64("native")
        hostOs == "Linux" -> linuxX64("native")
        isMingwX64 -> mingwX64("native")
        else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
      }
      sourceSets {
        val nativeMain by getting { .. }
        val nativeTest by getting {
          dependsOn(nativeMain)
        }
      }
    }
    and have my implementation as
    // commonMain
    expect val FILE_SYSTEM: FileSystem
    
    // nativeMain
    actual val FILE_SYSTEM: FileSystem = FileSystem.SYSTEM
    Am I doing something wrong here? 🤔 jvm target is able to build and run fine
  • c

    clark

    09/07/2022, 4:44 AM
    Been working on a simple project that I'd like to consume from JS. Didn't realize you would have to use all of the package name anytime you wanted to use part of the package. Is it possible to make the different classes and methods in the package importable from the root?
    x
    s
    • 3
    • 4
Powered by Linen
Title
c

clark

09/07/2022, 4:44 AM
Been working on a simple project that I'd like to consume from JS. Didn't realize you would have to use all of the package name anytime you wanted to use part of the package. Is it possible to make the different classes and methods in the package importable from the root?
x

xxfast

09/07/2022, 5:47 AM
you can also keep all the typealiases in the root level and let the long-package names only be referenced in kotlin
typealias LoginDomain = au.com.gridstone.pscore.login.screens.LoginDomain
s

shaktiman_droid

09/07/2022, 1:35 PM
We just create a const on JS side and then use that everywhere so we don’t see full package name everywhere
export const getAbcSDK = () => sdk.com.xyz.abcSDK
c

clark

09/07/2022, 3:48 PM
These are great approaches. Thank you!
View count: 12