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

    kevin.cianfarini

    02/14/2022, 9:35 PM
    Is there any chance that Jetbrains would consider absorbing benasher44/uuid into a first party
    kotlinx.uuid
    library? I know we want to keep the Kotlin stdlib small, but not having an ecosystem default for utilities as universal as UUID makes fragmentation within the ecosystem annoying for library maintainers. I know in the past there was a prior discussion about absorbing the above library into the stdlib, which Jetbrains was receptive to, but it didn't seem to go anywhere. I'd like to revisit this issue 🙂
    ➕ 16
    b
    s
    +2
    • 5
    • 14
  • k

    kierans777

    02/15/2022, 5:55 AM
    Are there any resources available about how to integrate Swift code into a Kotlin library that uses
    suspend
    functions? For example if I have a Kotlin function
    suspend fun doSomething(something: suspend (String) -> String): String {
      ...
      something("hello")
      ...
    
      return "world"
    }
    I want to write a function in Swift and pass it to the Kotlin function ie:
    let swiftSomething = // create a Swift function
    ModuleKt.doSometthing(swiftSomething)
    However I'm not sure if that sort of idea is possible, or how to go about implementing it.
    r
    • 2
    • 3
  • w

    wbertan

    02/15/2022, 12:02 PM
    Hello! We are updating from Kotlin
    1.5.31
    to Kotlin
    1.6.10
    , and we are having an issue where the
    bitcode
    is not being included 👀
    :x:  ld: bitcode bundle could not be generated because '/Users/me/project-native/modules/iosframework/build/xcode-frameworks/Debug/iphoneos15.0/SharedCode.framework/SharedCode' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/Users/me/project-native/modules/iosframework/build/xcode-frameworks/Debug/iphoneos15.0/SharedCode.framework/SharedCode' for architecture arm64
    
    
    
    :x:  clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Our config is:
    kotlin {
        ios {
            binaries {
                framework {
                    baseName = "SharedCode"
                    embedBitcode(BitcodeEmbeddingMode.BITCODE)
    Found this message about the same case: https://kotlinlang.slack.com/archives/C3PQML5NU/p1639075566171200 Could it be a regression in the plugin?
    t
    l
    • 3
    • 3
  • g

    Grégory Lureau

    02/15/2022, 3:38 PM
    Hi! 👋 A bit surprised to learn that Coroutines (suspend methods) are only half-integrated in KMP. Looks like natives have a completionHandler but nothing to handle the cancellation, so objectiveC code cannot be cooperative to cancellation without writing our own code? Same for Js/Typescript where the usage of Promise don't allow cancellation afaik. The Kotlin code in common looks like if coroutines were ready but actually cancelling only works for JVM/Android ? Am I missing something here? Or is it something planned in a next release?
    n
    t
    • 3
    • 9
  • a

    Adrian Witaszak

    02/15/2022, 5:28 PM
    Hi. New KMM project generated in Android Studio. First iosApp run fails. Any clues?
    ** BUILD FAILED **
    
    
    The following build commands failed:	
    
    PhaseScriptExecution Run\ Script /Users/adrianwitaszak/Projects/KMP/MyApplication/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/Script-7555FFB5242A651A00829871.sh (in target 'iosApp' from project 'iosApp')
    
    > Task :shared:linkDebugFrameworkIosX64 FAILED
    e: Compilation failed: Could not initialize class llvm.llvm
    
     * Source files: 
     * Compiler version info: Konan: 1.6.10 / Kotlin: 1.6.10
     * Output kind: FRAMEWORK
    
    e: java.lang.NoClassDefFoundError: Could not initialize class llvm.llvm
    b
    a
    +2
    • 5
    • 38
  • i

    Igor Milakovic

    02/15/2022, 10:33 PM
    How do you guys handle errors in KMM? For example, I have this use case
    interface SignInUseCase {
        @Throws(Exception::class)
        suspend fun execute(email: String, password: String): Whatever
    }
    When I call this from iOS, I get
    signInUseCase.execute(email: email, password: password) { whatever, error in
        // Handle completion
    }
    Is there a way to have a custom error here, instead of NSError? Ideally, I'd like to have maybe a class or data class
    data class Error(
        val title: String
        val detail: String
    }
    t
    g
    • 3
    • 28
  • s

    Sterling Albury

    02/16/2022, 9:06 AM
    I'm having some difficulties with my interfaces from common dependencies getting renamed when built for iOS. I'm basically trying to do some super simple di...a shared kotlin module has a class implementation that I'm trying to pass as a dependency in iOS land to other classes/interfaces defined in other kotlin modules. so for an example that's a bit complicated, I have some common Kotlin modules,
    moduleA
    and then
    moduleB
    which has A as a dependency.
    moduleA
    has
    InterfaceA
    and a class that returns this type,
    class A { fun getInterfaceA(): InterfaceA = SomeImpl() }
    , and in
    moduleB
    , I have a class that takes this interface as a param, so
    class B(interfaceA: InterfaceA)
    . Now over in iOS land, I have a class
    Foo
    with an instance of class
    B
    like so,
    let var beeClass: B = B(interfaceA: interfaceA)
    where
    interfaceA
    is a member variable assigned during init, so
    var interfaceA: InterfaceA
    and
    init(interfaceA: InterfaceA) { self.interfaceA = interfaceA }
    . Lastly, when I try to create in instance of
    Foo
    with the help of an instance of class
    A
    like so,
    lazy var foo: Foo = Foo(a.getInterfaceA())
    , I get complaints from xcode about the argument types not conforming to the expected types because
    InterfaceA
    is now called
    AInterfaceA
    . Moreover, if I go to the definition of class
    B
    in xcode,
    InterfaceA
    is named something like
    BAInterfaceA
    . Casting only seems to cause the app to crash and that's what xcode is suggesting I do. not sure if anyone followed that and has some idea what is going on. is there maybe some way to help the kotlin compiler with binding names or something? This doesn't really feel like a situation where the compiler should be changing the name of this interface and almost wonder if this could be a bug
    e
    g
    • 3
    • 6
  • c

    Charles Prado

    02/16/2022, 11:50 AM
    Hi! I’m getting an
    InstanceCreateException
    on my iOS app when I try to do a request to an API from the shared module.
    Uncaught Kotlin exception: org.koin.core.error.InstanceCreationException: Could not create instance for [Singleton:'com.test.remote.BookingApi']
    Any idea why this is not being recognized on the iOS-side? (My
    Koin.kt
    and
    BookingAPI.kt
    files are described in the thread),
    g
    • 2
    • 3
  • n

    Nathan Bedell

    02/16/2022, 1:54 PM
    Hi all. I have a multiplatform project where I am trying to target both Android and generic JVM targets. The issue is, both of these targets have to have different gradle plugins applied, so I cannot put all of the plugins at the top of my root build.gradle file. So my question is: Where should I apply a Gradle plugin so that it will only be applied for one platform? I have tried putting them in:
    Kotlin {
        platformA {
            // apply plugins for platformA here
        }
        platformB {
            // apply plugins for platformB here
        }
    }
    but this seems to cause issues. Right now, I get the error "The java plugin has been applied, but it is not compatible with the Android plugins". It seems as though it is trying to apply the plugins during the initial gradle config, not when building a specific platform. Is it possible to do what I am trying to do here?
    🇳🇴 1
    e
    a
    • 3
    • 8
  • r

    Roger Kreienbühl

    02/17/2022, 7:18 AM
    Hi I am new to kmm. I started with AppCode and created a new kmm project. When I want to build the app for iOS I ran into the following error:
    ld: building for iOS Simulator, but linking in dylib built for iOS, file '../../../../../shared/build/bin/iosArm64/debugFramework/shared.framework/shared' for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    > Task :iosApp:buildIosAppMain FAILED
    
    The following build commands failed:
    	Ld /Users/rogerkreienbuehl/Programmieren/HelloWorld/iosApp/build/bin/iosApp/Debug-iphonesimulator/HelloWorld.app/HelloWorld normal (in target 'iosApp' from project 'iosApp')
    (1 failure)
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':iosApp:buildIosAppMain'.
    > Process 'command 'xcrun'' finished with non-zero exit value 65
    I work on a MacBook Pro M1 with macOS 12.1 and xCode 13.2.1. How can I fix this linking error?
    a
    v
    • 3
    • 11
  • d

    darkmoon_uk

    02/17/2022, 11:20 AM
    KMP: I want the Unit Tests in one module to depend on the Test classes from another module. Anyone successfully doing this in a Kotlin Multiplatform project? This is a fairly well trodden question in Gradle generally [1][2]; but these solutions don't apply to multi-platform Kotlin. I saw this issue which suggests Multiplatform is not capable of establishing a test-to-test dependency at the moment. This is disappointing: I have a module structure that enforces clean architecture in my project, but am having to flatten all Test classes to the 'top level' module because they can't participate in the dependency hierarchy. Any suggestions?
    a
    g
    • 3
    • 2
  • k

    kevin.cianfarini

    02/17/2022, 4:03 PM
    Is this a Kotlin/JS compiler bug?
    e: java.lang.AssertionError: typeParameters = [] size != typeArguments = [org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl@ccfbb239, org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl@6b488739] size 
            at org.jetbrains.kotlin.ir.overrides.IrOverridingUtilKt.buildFakeOverrideMember(IrOverridingUtil.kt:70)
            at org.jetbrains.kotlin.ir.overrides.FakeOverrideBuilderStrategy.fakeOverrideMember(IrOverridingUtil.kt:28)
            at org.jetbrains.kotlin.ir.overrides.IrOverridingUtil.buildFakeOverridesForClass(IrOverridingUtil.kt:148)
            at org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder.buildFakeOverrideChainsForClass(FakeOverrides.kt:104)
            at org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder.provideFakeOverrides(FakeOverrides.kt:166)
            at org.jetbrains.kotlin.backend.common.overrides.FakeOverrideBuilder.provideFakeOverrides(FakeOverrides.kt:174)
            at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.postProcess(KotlinIrLinker.kt:207)
            at org.jetbrains.kotlin.ir.backend.js.KlibKt.loadIr(klib.kt:351)
            at org.jetbrains.kotlin.ir.backend.js.KlibKt.loadIr$default(klib.kt:232)
            at org.jetbrains.kotlin.ir.backend.js.CompilerKt.compile(compiler.kt:97)
            at org.jetbrains.kotlin.ir.backend.js.CompilerKt.compile$default(compiler.kt:42)
            at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.doExecute(K2JsIrCompiler.kt:306)
            at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:182)
            at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:75)
            at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
            at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
            at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
            at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1574)
            at jdk.internal.reflect.GeneratedMethodAccessor101.invoke(Unknown Source)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.base/java.lang.reflect.Method.invoke(Method.java:566)
            at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
            at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
            at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
            at java.base/java.security.AccessController.doPrivileged(Native Method)
            at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
            at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
            at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
            at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
            at java.base/java.security.AccessController.doPrivileged(Native Method)
            at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
            at java.base/java.lang.Thread.run(Thread.java:829)
    g
    r
    • 3
    • 7
  • c

    colintheshots

    02/17/2022, 7:59 PM
    I’m having issues where Android Studio no longer sees classes declared in AndroidMain sourceSet from the androidApp module. I have
    implementation(project(":shared"))
    at the top of my Android
    build.gradle.kts
    file’s dependencies list. The project builds and runs fine, but I get syntax errors in the IDE, Problems pane, and when I try to commit it warns me about all of the fake errors in changed files. This started when I first upgraded to Bumblebee. The same issues do not occur with any code referenced from commonMain. Does anyone have any ideas how I can resolve this?
    j
    m
    • 3
    • 8
  • j

    jean

    02/17/2022, 9:44 PM
    I just tried to create a brand new kotlin multiplatform from IntelliJ and I got an error right away
    Could not open init generic class cache for initialization script ‘/private/var/folders/1f/_13x62m52cd0b42d6ss7kpy00000gn/T/wrapper_init.gradle’ (/Users/jeantuffier/.gradle/caches/7.1/scripts/dpq13m6f9134zige235n01ule).
    > BUG! exception in phase ‘semantic analysis’ in source unit ‘_BuildScript_’ Unsupported class file major version 61
    * 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.
    h
    • 2
    • 2
  • d

    David Nedrow

    02/18/2022, 3:41 AM
    So I have a functional test library that compiles and works fine for both iOS and Android. Now I want to transpile to javascript as well. Is it just a matter of adding directives to the library's sourceSets in the gradle file? I assume it's something akin to jsmain and jstest.
    a
    • 2
    • 1
  • k

    khairil.ushan

    02/18/2022, 6:51 AM
    I created a KMM application using Android Studio, I am able to run the Android and iOS app. Then I created a macOS app that I want to make it depends on the Kotlin Module as well. I tried to copy the build phase from iOS to the macOS project but fail with this error
    Showing All Messages
    > Task :mylibrary:embedAndSignAppleFrameworkForXcode FAILED
    
    /Users/username/Library/Developer/Xcode/DerivedData/MyApp-macOS-bcjmruopehjfwogkwonshzamndam/Build/Products/Debug/MyApp-macOS.app/Contents/Frameworks/MyLibrary.framework/MyLibrary: replacing existing signature
    
    /Users/username/Library/Developer/Xcode/DerivedData/MyApp-macOS-bcjmruopehjfwogkwonshzamndam/Build/Products/Debug/MyApp-macOS.app/Contents/Frameworks/MyLibrary.framework/MyLibrary: bundle format is ambiguous (could be app or framework)
    
    
    
    FAILURE: Build failed with an exception.
    
    
    
    * What went wrong:
    
    Execution failed for task ':mylibrary:embedAndSignAppleFrameworkForXcode'.
    
    > Process 'command 'codesign'' finished with non-zero exit value 1
    Is there anything extra that I should do to link the framework to the macOS app properly?
    r
    l
    • 3
    • 5
  • y

    ynsok

    02/18/2022, 11:50 AM
    Hi 😄 Is there a possibility for keeping resources(strings, dimens, colors) in the common module and then used in shared Compose compositions that are kept in commonMain?
    m
    • 2
    • 5
  • m

    Matti MK

    02/18/2022, 1:00 PM
    I’m currently running Xcode 12.5.1 but would like to update to Xcode 13. From KMM perspective, would there be anything blocking this?
    k
    n
    +2
    • 5
    • 8
  • s

    spierce7

    02/18/2022, 4:41 PM
    The default dispatcher for native on coroutines mt is
    Dispatchers.Main
    right?
    m
    • 2
    • 1
  • b

    bod

    02/18/2022, 5:14 PM
    Hello, World! Hey I’m getting an
    Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option
    error when implementing an interface which doesn’t have any default methods (okio’s Source) 🤔.  What am I missing? (have this on an MP project, works without issue on a regular JVM project)
    👀 1
    • 1
    • 1
  • m

    Matti MK

    02/18/2022, 9:49 PM
    I’m writing some unit tests for a class with a dependency for
    Ktor
    HttpClient
    . Tests work just fine on Android, but on iOS getting:
    kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.test.TestScopeImpl@338a688
    I pretty much copy+pasted the ktor test sample. Source in comments. Any tips would be welcome 👍
    👀 1
    j
    • 2
    • 12
  • m

    Michael Paus

    02/19/2022, 11:49 AM
    I am suffering heavily from this bug
    <https://youtrack.jetbrains.com/issue/KTIJ-18408>
    but the mentioned workaround does not work for me because I cannot build my project anymore if I apply it. I wonder though why nobody else seems to care and why this bug is flagged as obsolete. I am using the latest EA build of IntelliJ in a multi-platform Compose project (desktop & android) which was basically created from the IntelliJ template.
    z
    • 2
    • 2
  • a

    Alen Kirm

    02/20/2022, 9:31 AM
    KMM - Monorepo or Multirepo? Hi all. In the last weeks as we’ve been setting up our KMM project, we came across interesting debate about which repo approach should we use - mono repo or multi repo. What are you guys using in your KMM projects? Are there any issues you’ve faced that made you switch repo from mono to multi or vice versa? Both of these approaches have its own pros and cons, but I see more pros in using multi repo approach (shared logic added as a git submodule into ios/android repo): • smaller repo size (specially in the future there may be platform specific binaries in the repo, same goes for assets…) • platform specific CI settings, versioning (tags), pull requests and branches • no need to clone whole project, specially as there are some guys on android and some guys working on iOS project • in the future there might be other platforms using shared module and having all platforms in one repo does not make sense IMO. • and so on One challenge is, how to assure “green-develop/master” on shared module. We’ve been thinking about approach where some feature will be implemented, and there will be changes on common repo. We could probably open a pull request and once tests and everything is green, git workflow could open PR’s for iOS and Android as well. Any opinions, feedback how you guys face this? What are best practices for huge projects?
    h
    e
    +3
    • 6
    • 12
  • c

    Conrad Kramer

    02/20/2022, 11:25 PM
    Are there instructions anywhere to build a full Kotlin toolchain on macOS? I am running macOS 12.3 Beta, and the
    libllvmstubs.dylib
    stub is seemingly not ABI stable, because it fails to load:
    $ ./gradlew :Shared:linkReleaseFrameworkIosArm64
    …
    > Task :Shared:linkReleaseFrameworkIosArm64 FAILED
    e: Compilation failed: Can't load library: /Users/conradev/.konan/kotlin-native-prebuilt-macos-aarch64-1.6.10/konan/nativelib/3037511274092129360/libllvmstubs.dylib
    
     * Source files:
     * Compiler version info: Konan: 1.6.10 / Kotlin: 1.6.10
     * Output kind: FRAMEWORK
    
    e: java.lang.UnsatisfiedLinkError: Can't load library: /Users/conradev/.konan/kotlin-native-prebuilt-macos-aarch64-1.6.10/konan/nativelib/3037511274092129360/libllvmstubs.dylib
    …
    the underlying link error seems to be something like this (in libc++):
    error: dlopen(/Users/conradev/.konan/kotlin-native-prebuilt-macos-aarch64-1.6.10/konan/nativelib/3037511274092129360/libllvmstubs.dylib, 0x0002): Symbol not found: __ZNKSt3__114error_category10equivalentERKNS_10error_codeEi
      Referenced from: /Users/conradev/.konan/kotlin-native-prebuilt-macos-aarch64-1.6.10/konan/nativelib/3037511274092129360/libllvmstubs.dylib
      Expected in: unknown
    h
    • 2
    • 5
  • c

    Conrad Kramer

    02/21/2022, 6:18 AM
    This is super random, but it would be great to document
    assembleAppleFrameworkForXcode
    somewhere. I needed to use it to depend on a Kotlin framework from an iOS framework, because
    embedAndSignAppleFrameworkForXcode
    only works in app targets
    s
    t
    • 3
    • 7
  • s

    Stefan Oltmann

    02/21/2022, 8:18 AM
    I want my app to sync in the background. For Android there is the WorkManager and iOS has a BGTaskScheduler. What is the best practice to do that on Windows/JVM (Compose for Desktop) and macOS (SwiftUI native)? And the real question: Does anybody already know a Kotlin framework that builds on top of all those so I have to code it just once? 🙂
    d
    • 2
    • 1
  • a

    Andrew O Hart

    02/21/2022, 5:04 PM
    Hey all. I was wondering if anybody has ran into issues with test modules not being able to access internal elements in the non test modules? I keep getting "Cannot access 'Blah': it is internal"
    g
    • 2
    • 8
  • s

    Sterling Albury

    02/21/2022, 6:41 PM
    I've got some kotlin navtive
    stately
    questions. So I have an object with two
    IsolateState
    fields and two setter functions:
    object FooIos {
    	actual val fooList = IsolateState { mutableListOf<MyInterface>() }
    
        actual val fooString = IsolateState { DataClassWithVarStringField("") }
    
        actual fun setStringValue(fooStringValue: String) {
            fooString.access { it.varField = fooStringValue }
        }
    
        actual fun addMyInterfaceCollection(myInterfaceCollection: Collection<MyInterface>) {
            fooList.access { it }.addAll(myInterfaceCollection.toList())
        }
    
        actual fun doStuff() {
        	fooList.access { item -> 			// fooList is empty
                println("fooList item: $item")
            }
    
            explicitTag.access { objWithStr ->
                println("objWithStr: $objWithStr") // not empty...prints expected value
            }
        }
    }
    So far this seems to work. I set the values on the main thread and I can see that the fields are populated, however, later on when I try to use these, fooList is empty regardless of what thread I'm on. I've been trying a number of different things but for some reason I keep loosing the list. What am I missing? I haven't tried the stately collections yet. Second thing is when I try to access the stately field like
    val strValue = fooString.access { it }
    , it crashes. The exception is
    FreezingException: freezing of Ok(result=DataClassWithVarStringField(varField=test)) has failed, first blocker is DataClassWithVarStringField(varField=test)
    r
    m
    • 3
    • 6
  • t

    Tony Kazanjian

    02/22/2022, 2:05 AM
    Paring down my question since it was a bit much codewise 😅 . I'm struggling with how to deal with this *`Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared kotlinx.coroutines.internal.DispatchedContinuation@2d8048 from other thread` *error. I've copied an implementation of the KaMPKit
    NativeViewModel
    and have my iOS network implementation done separately in an interface using
    URLSession
    . Is there anything within the Kotlin/Native concurrency model that makes calling a
    URLSession
    with a completion handler callback impossible? I'm pretty sure I've done everything I can to make my data state immutable.
    class SearchViewModel(
        private val repository: SearchRepository,
        private val onSearchState: (SearchState) -> Unit
    ): KoinComponent {
    
        private val scope = MainScope(Dispatchers.Main)
    
        private val _searchStateFlow = MutableStateFlow(SearchState())
    
        init {
            ensureNeverFrozen()
            observeQueries(_searchStateFlow.value.query)
        }
    
        @OptIn(FlowPreview::class)
        @Throws(Exception::class)
        fun observeQueries(query: String) {
            _searchStateFlow.value = SearchState(
                query = query,
                isLoading = true)
            scope.launch {
                repository.searchGames(_searchStateFlow.asStateFlow())
                    .collect { state ->
                        onSearchState(state)
                    }
            }
        }
    }
    The error happens on the completion handler that is called in the
    IOSSearchInteractor
    's URLSession callback:
    class IOSSearchInteractor: SearchInteractor {
        func searchGames(query: String, completion: @escaping (Result<String, Error>) -> Void) {
    
            var request ...
            let task = URLSession.shared.dataTask(with: request) { data, response, error in
                // error happens here on completion handler
                let str = String(decoding: data!, as: UTF8.self)
                completion(.success(str))
    
            }
            task.resume()
        }
    r
    k
    • 3
    • 3
  • v

    vishal G

    02/22/2022, 6:37 AM
    Is it possible to use jetpack compose with moko mvvm? If yes, can you suggest some examples because the archlivedata provided by moko is not compatible to observe as state in compose. Any suggestion will be helpful
    👍 1
    a
    d
    • 3
    • 3
Powered by Linen
Title
v

vishal G

02/22/2022, 6:37 AM
Is it possible to use jetpack compose with moko mvvm? If yes, can you suggest some examples because the archlivedata provided by moko is not compatible to observe as state in compose. Any suggestion will be helpful
👍 1
a

alex009

02/22/2022, 1:46 PM
https://github.com/icerockdev/moko-mvvm/issues/163#issuecomment-1035709582
v

vishal G

02/22/2022, 1:48 PM
👍 👍 👍
d

David Nedrow

02/23/2022, 6:53 PM
I wish GitHub had voting for issues.
View count: 45