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

    saket

    10/03/2021, 6:59 PM
    https://medium.com/@kpgalligan/testing-the-kotlin-native-memory-model-d3ccd2c2810f
    👀 1
    f
    k
    • 3
    • 2
  • w

    Waqas Tahir

    10/04/2021, 8:59 AM
    how to post a multiplatform library to github packages ?
    k
    • 2
    • 5
  • s

    Slackbot

    10/04/2021, 11:27 AM
    This message was deleted.
    l
    h
    • 3
    • 2
  • h

    Hamza Ahmad

    10/04/2021, 11:38 AM
    mport org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
    plugins {
        kotlin("multiplatform")
        kotlin("plugin.serialization") version "1.5.0"
        id("com.android.library")
        id("com.squareup.sqldelight")
    }
    repositories {
        google()
        mavenCentral()
    }
    
    kotlin {
        android()
    
        val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
            if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
                ::iosArm64
            else
                ::iosX64
    
        iosTarget("ios") {
            binaries {
                framework {
                    baseName = "shared"
                }
            }
        }
    
        sourceSets {
    
            val ktorVersion = "1.5.4"
    
            val commonMain by getting {
                dependencies {
    //                implementation("com.facebook.android:facebook-android-sdk:[5,6)")
    //                implementation("com.google.android.material:material:1.3.0")
    //                implementation("com.google.firebase:firebase-messaging:10.2.1")
    //                implementation("com.google.android.gms:play-services:10.2.1")
    //                implementation("com.google.android.gms:play-services-ads:10.2.1")
    //                implementation("com.google.firebase:firebase-core:10.2.1")
    //                implementation("com.google.firebase:firebase-auth:10.2.1")
    //                implementation("com.github.siyamed:android-shape-imageview:0.9.+@aar")
    //                implementation("com.github.barteksc:android-pdf-viewer:3.1.0-beta.1")
    //                implementation("org.apache.commons:commons-io:1.3.2")
    
                      // Logger
                      implementation("com.github.aakira:napier:1.4.1")
    
                      implementation("io.ktor:ktor-client-core:$ktorVersion")
                      implementation("io.ktor:ktor-client-serialization:$ktorVersion")
                      implementation("io.ktor:ktor-client-logging:$ktorVersion")
    
                      implementation("com.squareup.sqldelight:runtime:1.5.0")
    
    //                implementation("com.google.android.material:material:1.3.0")
    //                implementation("androidx.appcompat:appcompat:1.2.0")
    //                implementation("androidx.legacy:legacy-support-v13:1.0.0")
    //                implementation("androidx.core:core:1.0.0")
    //                implementation("androidx.legacy:legacy-support-v4:1.0.0")
    //                implementation("androidx.constraintlayout:constraintlayout:1.1.3")
    //                implementation("com.android.support.constraint:constraint-layout:")
    //                implementation("com.google.firebase:firebase-messaging:10.2.1")
    //                implementation("com.google.android.gms:play-services:10.2.1")
    //                implementation("com.google.android.gms:play-services-ads:10.2.1")
    //                implementation("com.google.firebase:firebase-core:10.2.1")
    //                implementation("com.google.firebase:firebase-auth:10.2.1")
    //                implementation("com.github.siyamed:android-shape-imageview:0.9.+@aar")
    //                implementation("com.facebook.android:facebook-android-sdk:[5,6)")
    //                implementation("androidx.mediarouter:mediarouter:1.0.0")
    //                implementation("androidx.vectordrawable:vectordrawable:1.0.0")
    //                implementation("com.github.barteksc:android-pdf-viewer:3.1.0-beta.1")
    //                implementation("org.apache.commons:commons-io:1.3.2")
    //                implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.30")
                }
            }
    
            val commonTest by getting {
                dependencies {
                    implementation(kotlin("test-common"))
                    implementation(kotlin("test-annotations-common"))
                }
            }
            val androidMain by getting {
                dependencies {
    
                    implementation("com.squareup.sqldelight:android-driver:1.5.0")
    
                    implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
    
                    implementation("androidx.multidex:multidex:2.0.0")
                    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
                    implementation(files("libs/ksoap2-android-assembly-3.3.0-jar-with-dependencies.jar"))
                    implementation(files("libs/pinchzoom.jar"))
                    implementation(files("libs/org.apache.commons.net_2.0.0.v200905272248.jar"))
                    implementation(files("libs/StartAppInApp-3.4.2.jar"))
                    implementation(files("libs/picasso-2.5.2.jar"))
                    implementation("com.google.android.material:material:1.3.0")
                    implementation("androidx.appcompat:appcompat:1.2.0")
                    implementation("androidx.appcompat:appcompat:1.0.0")
                    implementation("androidx.legacy:legacy-support-v13:1.0.0")
                    implementation("androidx.core:core:1.0.0")
                    implementation("androidx.legacy:legacy-support-v4:1.0.0")
                    implementation("androidx.constraintlayout:constraintlayout:1.1.3")
                    implementation("com.android.support.constraint:constraint-layout:")
                    implementation("com.google.firebase:firebase-messaging:10.2.1")
                    implementation("com.google.android.gms:play-services:10.2.1")
                    implementation("com.google.android.gms:play-services-ads:10.2.1")
                    implementation("com.google.firebase:firebase-core:10.2.1")
                    implementation("com.google.firebase:firebase-auth:10.2.1")
                    implementation("com.github.siyamed:android-shape-imageview:0.9.+@aar")
                    implementation("com.facebook.android:facebook-android-sdk:[5,6)")
                    implementation("androidx.mediarouter:mediarouter:1.0.0")
                    implementation("androidx.vectordrawable:vectordrawable:1.0.0")
                    implementation("com.github.barteksc:android-pdf-viewer:3.1.0-beta.1")
                    implementation("org.apache.commons:commons-io:1.3.2")
                    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.30")
    
                }
            }
            val androidTest by getting {
                dependencies {
    
                    implementation(kotlin("test-junit"))
                    implementation("junit:junit:4.13.2")
                }
            }
            val iosMain by getting {
                dependencies {
                    implementation("io.ktor:ktor-client-ios:$ktorVersion")
                    implementation("com.squareup.sqldelight:native-driver:1.5.0")
                }
            }
            val iosTest by getting
    
        }
    }
    
    apply { plugin("com.google.gms.google-services") }
    
    android {
        compileSdkVersion(30)
        sourceSets["main"].manifest.srcFile("src//androidMain//AndroidManifest.xml")
    
        defaultConfig {
            minSdkVersion(17)
            targetSdkVersion(30)
        }
    
    }
    
    val packForXcode by tasks.creating(Sync::class) {
        val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
        val framework = kotlin.targets.getByName<KotlinNativeTarget>("ios").binaries.getFramework(mode)
        val targetDir = File(buildDir, "xcode-frameworks")
    
        group = "build"
        dependsOn(framework.linkTask)
        inputs.property("mode", mode)
    
        from({ framework.outputDirectory })
        into(targetDir)
    }
    
    tasks.getByName("build").dependsOn(packForXcode)
    
    //dependencies {
    //    implementation(files("/Users/mbp/AndroidStudioProjects/PashtoLibrary/androidApp/libs/ksoap2-android-assembly-3.3.0-jar-with-dependencies.jar"))
    //    implementation(files("/Users/mbp/AndroidStudioProjects/PashtoLibrary/androidApp/libs/org.apache.commons.net_2.0.0.v200905272248.jar"))
    //    implementation(files("/Users/mbp/AndroidStudioProjects/PashtoLibrary/androidApp/libs/picasso-2.5.2.jar"))
    //    implementation(files("/Users/mbp/AndroidStudioProjects/PashtoLibrary/androidApp/libs/pinchzoom.jar"))
    //    implementation(files("/Users/mbp/AndroidStudioProjects/PashtoLibrary/androidApp/libs/StartAppInApp-3.4.2.jar"))
    //}
    
    
    sqldelight {
        database("LibraryApp"){
            packageName = "com.example.app.core.database"
            sourceFolders = listOf("db")
            dialect="sqlite:3.24"
        }
    }
    :thread-please: 1
    k
    • 2
    • 3
  • k

    Kurt Renzo Acosta

    10/04/2021, 1:35 PM
    Did anyone experience this when building iOS using Kotlin 1.5.30?
    Architecture i386 is not supported for platform iphonesimulator14.5
    n
    • 2
    • 5
  • j

    Joffrey

    10/04/2021, 4:52 PM
    Hey guys, is there any way to get the current Kotlin target from common code? I am writing a common test but the feature under test is not supported in Kotlin/Native, so I would like to just ignore the test on native. I could extract the test code into a common function and declare a test in every platform but the one to exclude, but that sounds inefficient
    🤔 1
    r
    a
    e
    • 4
    • 6
  • t

    Tarika Chawla

    10/05/2021, 4:31 PM
    Hi all, does anyone have any experience with moving the kmm module outside of the app directory. In my case, my app is in 
    main -> fixture -> android/ios
    . and the module is in 
    mmain -> kmm -> kmmtestmodule
     The pod istall and import works fine, but xcode build fails and I cant call any functions from the kotlin pod. Xcode Build Error:
    build.gradle.kts' line: 3
    
    * What went wrong:
    Plugin [id: 'org.jetbrains.kotlin.multiplatform'] was not found in any of the following sources:
    
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (plugin dependency must include a version number for this source)
    g
    • 2
    • 11
  • k

    Konstantin Tskhovrebov

    10/05/2021, 5:34 PM
    KMP wizard with live preview in your browser :) https://terrakok.github.io/kmp-web-wizard/
    :nice: 17
    🎉 4
    ❤️ 9
    :kotlinnew: 5
    🔥 3
    👏 5
    s
    • 2
    • 1
  • c

    CRamsan

    10/05/2021, 5:37 PM
    Has anyone encountered a bug in IntelliJ/AndroidStudio that breaks code highlighting/completion for Java projects that depend on KMM libraries that have both Android and JVM targets? My project compiles fine but the IDE seems to incorrectly use the Android target instead of the JVM target when doing autocompletion.
    j
    k
    • 3
    • 4
  • w

    willyrs

    10/06/2021, 6:39 AM
    can I have multiple "common" folders? e.g. (commonOneMain, commonTwoMain) I have two different js targets and I don't want to put in both all the commonMain code
    s
    k
    g
    • 4
    • 8
  • a

    anuj

    10/06/2021, 12:59 PM
    I declared Int in shared kmm model I am successfully able to use that in Android but in iOS we have kotlinInt how to convert it in string in iOS I am new in iOS
    w
    k
    +2
    • 5
    • 10
  • k

    kavi

    10/07/2021, 2:01 PM
    I think i’ve decided the worst thing about multiplatform is having to deal with xcode (the rest is great)! 😅 Here’s what i’m trying to achieve: 1. Multiplatform shared code that is exported as an xcframework using
    assembleXCFramework
    – called
    AnymoCore.xcframework
    2. This is then added as a framework to an iOS project (an SDK that I’m creating) which itself produces a framework – called
    Anymo.framework
    3. The final sdk framework is then consumed by apps – currently just a sample/test app So far my sample app seems to be running fine on the simulator but crashes when trying to run on a device…
    dyld: Library not loaded: @rpath/AnymoCore.framework/AnymoCore
      Referenced from: /private/var/containers/Bundle/Application/A863B34D-6A54-4D8E-A3A1-69BB07344DE5/iosApp.app/iosApp
      Reason: image not found
    If i add my xcframework to my test app directly and try to import some code from
    AnymoCore
    (rather than
    Anymo
    ) then it works so i think i’m just going wrong at step 2 maybe? I suspect it’s some xcode config or flag that i need to set correctly but am running out of ideas and would appreciate any tips 🙏🏾
    b
    k
    b
    • 4
    • 20
  • b

    Brian G

    10/07/2021, 3:16 PM
    Looking forward to AppCode being able to build kotlin MPP apps without me having to touch Xcode ever again 🤞
    💯 5
    b
    j
    • 3
    • 4
  • j

    Joffrey

    10/07/2021, 6:05 PM
    Is there any way to define
    @BeforeClass
    /
    @AfterClass
    in multiplatform common tests? AFAICT these annotations are JVM-only at the moment 😞 I could add cleanup after each test, but that's a bit overkill, and may not work for every use case.
    e
    b
    • 3
    • 14
  • w

    Waqas Tahir

    10/07/2021, 7:03 PM
    Tensorflow / Tensorflow lite for kotlin multiplatform projects ?
    j
    • 2
    • 1
  • m

    MarkRS

    10/08/2021, 9:20 AM
    Perhaps a very "getting-started" question, but it is multiplatform. AS is showing some code in red but still builds and runs the app. I'm guessing that this means I've got something skewiff with dependencies in my build.kts file, but I don't know what. In commonMain ktor in "import io.ktor.client.features.*" is red, and so are ClientRequestException and response in "e.response" (although Exception in "e: Exception" is fine). It may be these lines of code haven't run, but that shouldn't be relevant here, surely?
    g
    m
    • 3
    • 7
  • m

    MJegorovas

    10/08/2021, 10:23 AM
    Anybody had a problem when Kotlin couldn't cast Swift
    Int64
    to
    KotlinLong?
    , example in thread.
    e
    • 2
    • 4
  • j

    Joffrey

    10/08/2021, 2:34 PM
    I'm getting the following warning in a multiplatform library with iOS support:
    A compileOnly dependency is used in the Kotlin/Native target 'iosArm64'
    The
    commonMain
    source set indeed declares
    kotlinx-serialization-json
    as a
    compileOnly
    dependency. This is what I want for non-native targets (JVM, JS browser, JS node...) because it's supposed to be used this way (I don't want to force this JSON-specific dependency onto users that want to use other serialization formats). So I have a couple questions: 1. is this actually a problem? I mean, by default it's supposed to compile the native targets to a
    klib
    (not a linked binary) so why is this a problem? Shouldn't it be a problem on the consumer side when actually building a final binary? 2. if it is a problem, how can I solve it? I tried to add this dependency as
    implementation
    inside the
    iosMain
    source set, but it doesn't seem to solve the warning I'm tempted to just disable the warning with
    kotlin.native.ignoreIncorrectDependencies=true
    but I'd like to understand better if it's really a problem first.
    • 1
    • 1
  • j

    Jim

    10/08/2021, 5:28 PM
    Crossposting for visibility
    • 1
    • 1
  • h

    hsyogesh

    10/08/2021, 7:39 PM
    Guys I have a used case like getting csrf token from my backend service on post auth call, which is a prerequisite for all my further requests, can i get a help how to achieve this in Ktor as I dont see such used cases mentioned in documentation, bcz my backend service returns 302 with redirection exception, i don't care about exception but what i need is csrf token received from response
    a
    • 2
    • 2
  • m

    Mejdi

    10/08/2021, 9:00 PM
    👋 To use
    SharedFlow
    on iOS, do we need to use the
    -native-mt
    version of kotlinx coroutines ? Same goes with the
    Mutex
    APIs. Both don’t seem to work using the core version of it. I want to verify this before setting any conclusion. In the docs we set the
    common
    label against them, would that mean that these are supported in all platforms ?
    d
    • 2
    • 3
  • e

    Eric Ampire [MOD]

    10/09/2021, 12:31 PM
    Hello, I have created a KMM project where the shared module is named common, I can use easily the common module in the android app but when it came to create the framework for the ios project I got his error Task 'embedAndSignAppleFrameworkForXcode' not found in project ':common'.
    r
    • 2
    • 1
  • p

    pererikbergman

    10/09/2021, 2:25 PM
    Hello, I am tearing the little I have left of my hair 🙂 I have a KMM project test up and get this error when building from XCode:
    Command PhaseScriptExecution failed with a nonzero exit code
    Seem to work from Android Studio, even the iOS build… 🤔 If I dig down a little bit into the logs in XCode I find this:
    > Task :shared:linkDebugFrameworkIos FAILED
    e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
    Please try to disable compiler caches and rerun the build. To disable compiler caches, add the following line to the gradle.properties file in the project's root directory:
       
      kotlin.native.cacheKind.iosX64=none
       
    Also, consider filing an issue with full Gradle log here: <https://kotl.in/issue>
    The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
    output:
    ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin//libclang_rt.ios.a, missing required architecture x86_64 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin//libclang_rt.ios.a (4 slices)
    Undefined symbols for architecture x86_64:
     "___cpu_model", referenced from:
       polyHash_x86(int, unsigned short const*) in libstdlib-cache.a(result.o)
    ld: symbol(s) not found for architecture x86_64
    
    FAILURE: Build failed with an exception.
    I am totally lost, anyone have any idea or where to start looking?
    r
    w
    m
    • 4
    • 10
  • j

    John O'Reilly

    10/09/2021, 6:02 PM
    Are people using any particular approach for triggering the execution of shared code when application starts up (other than explicitly invoking from say Android and iOS app layer code at the appropriate time)?
    b
    p
    +2
    • 5
    • 11
  • g

    Grégory Lureau

    10/10/2021, 1:38 PM
    Seeing a weird export for iOS when I define a class inheriting for another open one (or a sealed class). When I've this code:
    open class BaseClass(internal val internalVal: String)
    class FooBar(val exposedVar: Int) : BaseClass("internalValue")
    In Kotlin I only see one and only one FooBar constructor with the
    Int
    param. But the header from XCFramework exposes 2 constructors
    __attribute__((swift_name("BaseClass")))
    @interface KmpTestBaseClass : KmpTestBase
    - (instancetype)initWithInternalVal:(NSString *)internalVal __attribute__((swift_name("init(internalVal:)"))) __attribute__((objc_designated_initializer));
    @end;
    
    __attribute__((objc_subclassing_restricted))
    __attribute__((swift_name("FooBar")))
    @interface KmpTestFooBar : KmpTestBaseClass
    - (instancetype)initWithExposedVar:(int32_t)exposedVar __attribute__((swift_name("init(exposedVar:)"))) __attribute__((objc_designated_initializer));
    - (instancetype)initWithInternalVal:(NSString *)internalVal __attribute__((swift_name("init(internalVal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
    @property (readonly) int32_t exposedVar __attribute__((swift_name("exposedVar")));
    @end;
    I know I could make the BaseClass constructor private to avoid that export, but it doesn't feel adequate to exposes this 2nd constructor on FooBar anyway... What am I missing? Also I noticed the
    unavailable
    not sure what this means 😕
    • 1
    • 2
  • k

    KamilH

    10/11/2021, 12:26 PM
    What could be a reason for the lack of availability of
    embedAndSignAppleFrameworkForXcode
    task? I’m using
    Kotlin 1.5.31
    and simply I can’t see this task in my
    shared
    module.
    h
    • 2
    • 2
  • g

    Gus Ward

    10/12/2021, 9:34 AM
    Hey! We are getting lots of unresolved dependancies our build files although the project actually builds and runs fine, have tried invalidate caches / restart, deleting .idea & .gradle folders and re importing, updating the the latest version of most dependancies, has anyone solved this issue before? Current set up is Android Studio,
    Kotlin 1.5.31
    ,
    AGP 4.1.3
    and its a library project for iOS & Android.
    j
    m
    a
    • 4
    • 6
  • c

    chi

    10/12/2021, 10:42 AM
    I'm having an issue setting up my multiplatform project for unit testing with Koin. When I add the the Koin jUnit4 dependency it completely breaks every other dependencies as all gets missing.
    val commonTest by getting {
        dependencies {
            implementation(kotlin("test-common"))
            implementation(kotlin("test-annotations-common"))
            implementation("io.insert-koin:koin-test:${versions.koin}")
            implementation("io.insert-koin:koin-test-junit4:${versions.koin}")
            implementation("io.mockk:mockk-common:1.12.0")
        }
    }
    What could be wrong here?
    e
    • 2
    • 2
  • d

    Danish Ansari

    10/12/2021, 2:54 PM
    I have very simple question regarding KMM. Can I export module (written completely in Kotlin) as an iOS library(same as *.aar in Android) from Windows PC and use it in iOS application project on macOS? Actual requirement: https://kotlinlang.slack.com/archives/C3PQML5NU/p1634050993470800?thread_ts=1634050480.468500&amp;cid=C3PQML5NU
    k
    t
    • 3
    • 12
  • r

    raulraja

    10/12/2021, 9:19 PM
    Hello! I have a use case where I would like to ship a library with
    expect
    declarations only in common main and have multiple
    actual
    different impl on each platform. For example 3 JVM modules that provide 3 different
    actual
    impls for the common main and same for other platforms like JS. The use case is that users may define programs over the common library but choose different runtime impl in
    actual typealias F<A> = CustomImpl<A>
    data types for a given expect class depending on how they want their programs to run. Essentially I’d like to push the responsibility to declare the
    actual typealias
    to the user and not be forced to provide an impl myself. Can this be accomplished with multiplatform modules? Any help is appreciated, I realise this is an odd case and potentially trying to abuse expect / actual for ad-hoc resolution. Thanks!
    m
    r
    • 3
    • 3
Powered by Linen
Title
r

raulraja

10/12/2021, 9:19 PM
Hello! I have a use case where I would like to ship a library with
expect
declarations only in common main and have multiple
actual
different impl on each platform. For example 3 JVM modules that provide 3 different
actual
impls for the common main and same for other platforms like JS. The use case is that users may define programs over the common library but choose different runtime impl in
actual typealias F<A> = CustomImpl<A>
data types for a given expect class depending on how they want their programs to run. Essentially I’d like to push the responsibility to declare the
actual typealias
to the user and not be forced to provide an impl myself. Can this be accomplished with multiplatform modules? Any help is appreciated, I realise this is an odd case and potentially trying to abuse expect / actual for ad-hoc resolution. Thanks!
m

Mejdi

10/12/2021, 9:37 PM
why dont you have this part of the actual implementation ? Like having a facade Impl per platform, based on a certain parameters (so runtime flow will control this) it will choose the right implementation among the 3 present.
r

russhwolf

10/12/2021, 10:10 PM
I typically go with an
interface
rather than an
expect class
for this scenario.
😒ame: 3
r

raulraja

10/13/2021, 3:02 PM
@Mejdi @russhwolf thanks, I’ll give it some thought. I liked the fact that with actual / expect all abstract declarations in commonMain are like templates that get replaced by real types and not an inheritance relationship. I was able to provide some considerable polymorphic abstraction without the cost of double boxing on interfaces and classes just using the actual typealias.
View count: 4