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

    Nacho Ruiz Martin

    07/01/2021, 11:59 AM
    Hey people! Is there any way to make of a pure Kotlin module multiplatform?
    b
    j
    • 3
    • 3
  • p

    Paul Woitaschek

    07/01/2021, 12:18 PM
    Is there any sane way to let ios implement a suspending interface? When we have an interface that suspends:
    public fun runTest(suspending: SuspendingInterface) {
      CoroutineScope(Dispatchers.Default).launch {
        println(suspending.value())
      }
    }
    
    public interface SuspendingInterface {
    
      public suspend fun value(): Int
    }
    And ios switches threads:
    class SuspendingInterfaceImpl : SuspendingInterface{
      func value(completionHandler: @escaping (KotlinInt?, Error?) -> Void) {
        DispatchQueue.global().async {
          completionHandler(42, nil)
        }
      }
    }
    
    CoroutineTest.runTest(SuspendingInterfaceImpl())
    That directly fails with:
    kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared kotlinx.coroutines.internal.DispatchedContinuation@1f67dc8 from other thread
    👀 1
    b
    j
    • 3
    • 8
  • n

    Nicolas Verinaud

    07/01/2021, 1:46 PM
    [SOLVED] Hi ! I try to convert an ObjC method which uses C functions in Kotlin Native but it does not work 😞 Here is the ObjC / C code :
    - (NSString *) getSysInfoByName:(char *)typeSpecifier
    {
        size_t size;
        sysctlbyname(typeSpecifier, NULL, &size, NULL, 0);
        
        char *answer = malloc(size);
        sysctlbyname(typeSpecifier, answer, &size, NULL, 0);
        
        NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
    
        free(answer);
        return results;
    }
    And my Kotlin version :
    private fun sysInfoByName(identifier: String): String? {
            val size = cValue<size_tVar>()
            sysctlbyname(identifier, null, size, null, 0)
    
            var result: String? = ""
    
            memScoped {
                val value = allocArray<charfVar>(size.size)
                sysctlbyname(identifier, value, size, null, 0)
    
                result = NSString.stringWithCString(cString = value, NSUTF8StringEncoding)
            }
    
            return result
        }
    The result is always empty. 😞 Do you know why ? 😇
    b
    l
    • 3
    • 8
  • a

    andylamax

    07/02/2021, 7:56 AM
    Hi there, Currently I have been writing a lot of libraries. And the end users of my libraries a primarily not kotlin users. They are mostly Java. So, my API designs are now so highly considerate when developing API with an intention to provide nice interop. Current Status: When I write my API, all of the kotlin test reside in
    commonMain
    , and just for clarification, I write a couple of Java test in
    jvmTest/java
    as well to make my self confident that my Java users won't scream at me Question: Is there a way that I can configure my kotlin multiplafrom library and write javascript (or even better, typescript) test in typescript that consume my kotlin lib? something like
    jsTest/javascript
    or
    jsTest/typescript
    ? Extended Question: Can that be achieved similar to ObjC? C? say
    nativeTest/objectiveC
    or
    nativeTest/C
    🇳🇴 2
    b
    t
    • 3
    • 7
  • s

    Stefan Oltmann

    07/02/2021, 2:03 PM
    Does epect & actual work with interfaces? I want to define a Interface like so:
    expect interface Image
    
    expect interface ImageLoader {
    
        fun loadFullImage(photo: Photo): Image
    
        fun loadThumbnailImage(photo: Photo): Image
    
    }
    And for Android it should load a "ImageBitmap"
    actual interface Image // ???
    
    actual interface ImageLoader {
    
        actual fun loadFullImage(photo: Photo): ImageBitmap
    
        actual fun loadThumbnailImage(photo: Photo): ImageBitmap
    
    }
    And for iOS "Image" should be "UIImage" of course. Is that possible?
    ✅ 1
    o
    • 2
    • 4
  • a

    Alex Anisimov

    07/02/2021, 2:51 PM
    Attention all Kotlin Multiplatform users ❗️ Change the future of the technology by sharing your thoughts and feedback in the Kotlin Multiplatform user survey! Special prizes will be raffled after the survey. 🎁 https://surveys.jetbrains.com/s3/Kotlin-Multiplatform-user-survey-July-2021
    ✅ 22
    d
    • 2
    • 1
  • x

    xxfast

    07/03/2021, 2:20 AM
    Hi all, i have this view model delegate on ios side that looks like this
    import Foundation
    
    class ViewModelDelegate : ObservableObject {
    
        @Published var state: State = ViewModelsKt.DEFAULT_STATE
        @Published var command: Command? = nil
        
        init() {
            subscribe(viewModel: ModuleKt.viewModel)
        }
        
        func subscribe(viewModel: ViewModel) {
            viewModel.onChange { (state) in
                self.state = state
            }
        }
    }
    is it possible to use Combine’s
    @Published
    from kotlin side and get rid of this delegate all together?
    r
    • 2
    • 1
  • p

    pravin

    07/03/2021, 7:47 AM
    Does anyone have answer on this https://stackoverflow.com/questions/67949522/unable-to-build-kotlin-multiplatform-mobile-project-on-macbook-m1-chip?
    a
    s
    • 3
    • 2
  • k

    Kareem Radwan

    07/03/2021, 8:32 AM
    hi all, how we can use DI in KMM. I mean automatic DI for ApiServices, UseCases etc ? and ideas ?
    b
    • 2
    • 7
  • c

    Colton Idle

    07/03/2021, 5:47 PM
    Newbie question... I have an existing Android only project and it has an 
    app
     module, and then a 
    my_composables
     module. I converted the project to support kmm in order to get compose for desktop working. Now 
    my_composables
     is a kmm module with
    androidMain
    commonMain
    desktopMain
    main
    I put a brand new 
    HelloWorld
     composable in common, and can now use that common composable in my 
    app
     module and 
    desktopApp
     module. All is good with the world AND I can slowly migrate my android only composables from 
    main
     into 
    commonMain
     . That's my current strategy. Slowly migrate from 
    main
     into 
    commonMain
     . Is that "bad" or wrong? Should I just shove everything into 
    androidMain
     ? Basically asking "is 
    main
     in a kmm module a bad pattern?"
    🆗 3
    c
    • 2
    • 1
  • a

    Akram Bensalem

    07/04/2021, 3:40 PM
    I got error when import this librery
    implementation("com.arkivanov.decompose:extensions-compose-jetbrains:0.2.6")
    Any help ?
    a
    • 2
    • 1
  • a

    alexandrepiveteau

    07/04/2021, 10:51 PM
    Hi ! Gradle newbie question here. I’ve got a KMM project which uses
    kotlinx.serialization
    , and targets both Kotlin/JS and Kotlin/JVM (with a Compose for Desktop client). Compose for Desktop requires using Kotlin 1.5.10, but there’s a bugfix in
    kotlinx.serialization
    for Kotlin 1.5.20 which I need for my Kotlin/JS target. Would there a way for me to fix my Gradle project and satisfy these two requirements ? (code in 🧵)
    k
    g
    • 3
    • 7
  • r

    Robert Wijas

    07/05/2021, 4:15 PM
    I have a KMM project which I just updated to kotlin 1.5.20. All works fine, but Android Studio still thinks that my common module depends on 1.4.32. When I build with Gradle all seems to be correctly using version 1.5.20, I get warnings that I expect to get etc. But when I open the file with 1.5.20 warning Studio doesn’t highlight it and looks like it links edited file to 1.4.32. Any hints? TIA
    j
    k
    r
    • 4
    • 11
  • j

    Jason5lee

    07/06/2021, 1:05 AM
    I try to publish a multiplatform project to maven local but I get
    Unresolved reference: JvmInline
    at
    compileKotlinMetadata
    phrase.
    compileKotlinJvm
    works fine.
    r
    • 2
    • 2
  • s

    saket

    07/06/2021, 6:09 AM
    I’m banging my head over this for the past couple hours. Has anyone else run into this error while trying to build any native target?
    > Task :common:linkDebugTestMacOS FAILED
    e: Compilation failed: Deserializer for declaration public kotlinx.coroutines/cancel|8411479413341223858[0] is not found
    
     * Source files:
     * Compiler version info: Konan: 1.5.10 / Kotlin: 1.5.10
     * Output kind: STATIC_CACHE
    
    e: java.lang.IllegalStateException: Deserializer for declaration public kotlinx.coroutines/cancel|8411479413341223858[0] is not found
    I’m already forcing all transitive dependencies of coroutines to
    1.5.0-native-mt
    by using:
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-native-mt") {
      version { strictly("1.5.0-native-mt) }
    }
    g
    r
    +2
    • 5
    • 7
  • p

    predrag karic

    07/06/2021, 10:00 AM
    hi I am experiencing
    EXC_BAD_ACCESS
    when calling some use case. We are using clean arch and everything from domain layer is written in kotlin. We are manually freezing use case objects exposed to iOS. I noticed this in log
    /Users/teamcity/buildAgent/work/f01984a9f5203417/runtime/src/main/cpp/Memory.cpp:1581: runtime assert: add ref for reclaimed object
    and this is in Xcode:
    Thread 47: EXC_BAD_ACCESS (code=1, address=0x4aa017e2280)
    Every use case have a callback and the only difference with other calls to common (kotlin) code is that in this situation I am calling another use case from that callback… not sure if that can be a root cause of this issue… Really appreciate if someone can help me how to figure out why is this happening and how to resolve it. Thx in advance
    • 1
    • 2
  • s

    Stefan Oltmann

    07/06/2021, 12:20 PM
    I updated to macOS Monterey (12) Beta and now my Compose for Desktop application is blurry. It worked fine with macOS Big Sur (11). Did someone else have this problem?
    • 1
    • 1
  • b

    Bailey Pollard

    07/06/2021, 1:09 PM
    Are we able to use IsolateState from the stately library to wrap a nullable value? (edited)
    k
    • 2
    • 1
  • a

    Akram Bensalem

    07/06/2021, 5:36 PM
    I'm struggling with my first project on KMP. I creat a project simple from KMP plugin in IntilijIdea. Creating all the necessary module for me: Android, Desktop and web. After trying hard I succeeded in making Desktop and Web part compile The problem is with Android part it doesn't compile. And finally I created KMM project using Android Studio It works correctly but I failed to add it with the desktop and web project What I have to do ?! Is there any willing from Jetbrain team to improve the user experience with the plugin and the default project sample ?! 😢 ... By the way, I'm just a student have prior knowledge with Android (Kotlin/Java) But I have to make a website and Android App to my school So I think Kotlin multiplatform is the best choice as I master Kotlin ... So I'm asking if any one can help me in the gradle files And also if my choice of KMP is right ?! Or I have to pick another technology like Flutter/ React native instead
    b
    k
    • 3
    • 9
  • m

    miskalinn

    07/07/2021, 11:22 AM
    Is compose available on KMM?
    j
    m
    +2
    • 5
    • 20
  • b

    Bohdan

    07/07/2021, 11:07 PM
    Hi Everyone, I have a question about sharing viewmodels. We have quite big project - around 60-70 screens and a lot of features (offline mode, using camera, recording audio, billing, synchronization between server and other devices etc).In general I would say that it is typical client but quite massive. In some point we decided to rewrite it fully using kmm(Android + iOS). So after some research we rewrote one module with kmm and it worked fine - we even shared viewmodels in our prototype. But it is a small module for 5 screens.My question is rather a search for advice. Has anyone had experience writing a large project with kmm and shared viewmodels? Maybe someone has faced some specific issues while sharing viewmodels. On what put more attention? Probably viewmodels are not yet ready to be shared or it not worth it. In general possibility to share viewmodels looks quite appealing. But as this is our first project with kmm and quite big we would like to be sure that it is good idea. Thanks in advance for the reply.
    👍 1
    d
    m
    • 3
    • 3
  • g

    Guilherme Delgado

    07/08/2021, 8:44 AM
    Hello, just stumbled upon this on my github feed: https://github.com/sergeshustoff/dikt
    :kotlin-flag: 3
    :kotlin-intensifies: 3
    b
    • 2
    • 1
  • m

    Martin Rajniak

    07/08/2021, 12:26 PM
    Hi everybody, in our company we are evaluating KMP for sharing business code between our supported platforms: Windows, Mac, Android, iOS (potentially also JS since desktop UI is using it) - in this order of importance. We are deciding between sharing code in C++ library vs. KMP. Have someone already done a comparison? What is the biggest advantage to KMP when compared with C++ solution. Thank you for help.
    b
    k
    • 3
    • 57
  • t

    Tom Wayne

    07/09/2021, 5:40 AM
    Hello everybody, Iam developing KMM used by iOS and Android client. I need to use websockets there.Do you have experience with any library which works both for iOS and Android part? Thanks
    b
    h
    +3
    • 6
    • 13
  • b

    Bradford Canonigo

    07/09/2021, 8:15 AM
    Hi all, I am working on a KMM library project for android and ios, I have a separate module that contains data classes that are using
    Moshi
    annotations. I am having compile errors (
    Unresolved reference
    ) when using said data classes inside my KMM library. I've read articles that says it doesn't support other serializing dependencies other than the
    kotlinx.serialization
    . Is there a way to convert moshi data class into a kotlinx.serialized class inside a KMM project?
    m
    • 2
    • 3
  • s

    Simonas Brazauskas

    07/09/2021, 9:16 AM
    Hello, is it possible to have
    .dSYM
    for static frameworks? I am asking because when ios app crashes with kotlin native library, stack trace does not have anything useful. I have this from the symbolication documentation, but this only works with dynamic frameworks
    targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
            binaries.all {
                freeCompilerArgs += "-Xadd-light-debug=enable"
            }
        }
    I am using sqldelight library with sqlcipher, and if library is static i do not need to link
    lsqlcipher
    manually, otherwise if library is dynamic i need to link with either
    lsqlite3
    or
    lsqlcipher
    , but somehow it does not work and compiler complains that it cannot find
    lsqlcipher
    . I have added sqlcipher as cocoapod
    cocoapods {
            this.ios.deploymentTarget = "13.0"
            // Configure fields required by CocoaPods.
            summary = "Secoris core"
            homepage = "<https://github.com/JetBrains/kotlin>"
    
            // You can change the name of the produced framework.
            // By default, it is the name of the Gradle project.
            frameworkName = binaryBaseName
    
            pod("SQLCipher", "~> 4.4")
        }
    linking is done like this
    targets
           .flatMap { it.compilations }
            .filterIsInstance<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation>()
            .forEach { compilationUnit ->
                compilationUnit.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlcipher")
           }
    but this gives following error
    ld: library not found for -lsqlcipher
    . So in conclusion i am able to have encrypted database with sqlcipher if i use static library, with no linking needed, but then there is no
    .dSYM
    for crash stack traces, or i can have
    .dSYM
    with dynamic framework, but then sqldelight links to
    lsqlite3
    and there is no encryption.
    👀 1
    m
    • 2
    • 14
  • i

    iamthevoid

    07/09/2021, 9:25 AM
    Did anybody try move Compose code into multiplatform library? Code works perfect in android application module
    plugins {
        id("com.android.application")
        kotlin("android")
    }
    but when i move it to multiplatform library
    plugins {
        kotlin("multiplatform")
        id("com.android.library")
    }
    compilation fails. Stacktrace in thread.
    buildFeatures.compose
    enabled,
    composeOptions.kotlinCompilerExtensionVersion
    set too. What am i do wrong?
    👀 1
    r
    • 2
    • 2
  • l

    louiscad

    07/09/2021, 1:31 PM
    I'm upgrading Splitties (a set of multiplatform and Android libraries) to Kotlin 1.5.20 from 1.4.32, and last time I had made a full
    build
    on my machine (a MacBook Pro) was a long time ago and was very slow, ranging from 15 to 20 minutes… but now! Now, okay, I upgraded the computer a bit in the meantime, but they're in the same ballpark: from Late 2013 MBP with i7 and 16GB of RAM to 2020 MBP 10th gen i5 and 16GB of RAM. So now, it takes about 3 minutes, and I'm super happy, it'll make catching up and adding stuff much easier as I'll have the comfort of local feedback loops and IDE integration. Thank you so much for making the Kotlin/Native compiler faster! 🙏🏼 ❤️
    :kotlin-intensifies: 18
    i
    • 2
    • 3
  • j

    Jason5lee

    07/10/2021, 3:28 AM
    How to fix “modality is different” error?
    • 1
    • 1
  • e

    Elyes Ben Salah

    07/10/2021, 6:38 PM
    Hey guys I’m getting problem with SQLDelight I cant find the NativeSQLiteDriver I tried everything and I don’t get the problem, Here configuration
    j
    a
    +2
    • 5
    • 20
Powered by Linen
Title
e

Elyes Ben Salah

07/10/2021, 6:38 PM
Hey guys I’m getting problem with SQLDelight I cant find the NativeSQLiteDriver I tried everything and I don’t get the problem, Here configuration
j

John O'Reilly

07/10/2021, 7:28 PM
What's exact error you're getting? Am using that same version in following fwiw in case you want to do any comparison https://github.com/joreilly/PeopleInSpace
e

Elyes Ben Salah

07/10/2021, 7:39 PM
the problem I’m not getting an error , it’s just unresolved dependencies in the iOSMain 😕
some dependencies are seen others no
a

Abhishek Dewan

07/11/2021, 12:10 AM
are you not able to build the application or just that ide shows the error ?
if later probably needs a invalidate cache and restart
e

Elyes Ben Salah

07/11/2021, 9:25 AM
@Adarsh Gumashta just the IDE shows the error , I tried to invalidate the cache and same error , @John O'Reilly I tried also the project same problem iOSMain can’t see the Native libraries , so I think it’s problem related to my local environment , here my env conf : MacOS Big Sur 11.4 Android Studio 2021.1.1 Canary.3 KMM plugin : 0.2.6(211-1.5.10-release-891-IJ)-71 Java SDKMan : 8.0.292.hs-adpt & 11.0.11.hs-adpt switching between both if needed ( current : 11.0.11.hs-adpt)
j

John O'Reilly

07/11/2021, 9:26 AM
Not sure if it's a factor but I'm typically running using Arctic Fox beta these days
a

Adarsh Gumashta

07/11/2021, 9:27 AM
@Elyes Ben Salah I think you need to tag other person , i am not the correct one .
j

John O'Reilly

07/11/2021, 9:27 AM
Had been using Canary but switched to Arctic Fox once Jetpack Compose was supported on that
e

Elyes Ben Salah

07/12/2021, 9:34 AM
I endup by using Intellij IDEA with the Shared Project ( I added gradle wrapper and configure it as an Independent project) , strange problem couldn’t find solution , and everytime I add code and build the shared ( I disable android to avoid the gradle error Android Studio plugin outdate) and work in XCode that’s the only option same code works with IDEA but not Android studio
k

kpgalligan

07/12/2021, 3:13 PM
Dependency resolution issues like that are generally (for me) due to the hierarchical plugin. How do you declare your targets? If it's
ios()
vs
iosX64()
(or similar), that may be what's happening here. "work in XCode" you mean you can run it from XCode? I haven't been building with the KMM plugin as much, so does it not run if it can't resolve everything in the IDE?
Gradle and the IDE don't always agree.
e

Elyes Ben Salah

07/12/2021, 3:18 PM
here my config update :
kotlin {
    //android()

    val isDevice = System.getenv("SDK_NAME")?.startsWith("iphoneos") == true
    if (isDevice)
        iosArm64("ios")
    else
        iosX64("ios")

    targets.getByName<KotlinNativeTarget>("ios").compilations.forEach {
        it.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlite3")
    }

    cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        ios.deploymentTarget = "14.1"
        frameworkName = "shared"
        podfile = project.file("../iosApp/Podfile")
    }
k

kpgalligan

07/12/2021, 3:19 PM
Ah, weird. That should resolve OK then, at least for target related issues
e

Elyes Ben Salah

07/12/2021, 3:20 PM
I got Undefined symbols for architecture x86_64: sqldelight so I added ”
targets.getByName<KotlinNativeTarget>("ios").compilations.forEach {
        it.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlite3")
    }
and I’m working with Intellij IDEA 😕
k

kpgalligan

07/12/2021, 3:21 PM
If the sqlite3 linking fixed that, that's expected. sqldelight adds that linker option, but it only carries over if you have dynamic frameworks.
"Undefined symbols for architecture x86_64" only happens when you try to build, though, right? Not in the idea (not sure where it would)
e

Elyes Ben Salah

07/12/2021, 3:22 PM
yeah in XCode build
I’m really confused about the problem , I tried also github repositories got same error
View count: 11