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

    spierce7

    11/24/2020, 9:26 PM
    Can
    kotlin("multiplatform")
    projects depend on other gradle modules in the repo that are
    kotlin("jvm")
    ? I thought they could, but I’m seeing problems
    c
    a
    • 3
    • 3
  • s

    Shan

    11/24/2020, 9:47 PM
    Hello all. Is there a way to change the project name kmpp uses as the artifact ID for maven publishing? I have a format like this
    root
    |___core
         |__src
             |__commonMain
             |__jvmMain //etc
         |__build.gradle.kts
    |___otherModule
         |__src
            |__commonMain
            |__jvmMain //ec
         |__ build.gradle.kts
    |__settings.gradle.kts //root project name set here
    |__gradle.properties
    It's defaulting to
    core-jvm
    /
    core-metadata
    etc. right now for the artifact ID, but i'd like all of the generated artifact IDs to be
    foo-jvm
    /
    foo-metadata
    etc. I have been setting them all individually but feel like there might be a better way to just set that parameter once somewhere in the build script.
    a
    b
    • 3
    • 2
  • s

    Shan

    11/24/2020, 11:33 PM
    Err looks like the separate
    metadata
    default artifact was removed in Kotlin 1.4.20, but I'm still seeing it when listing out the default publication names.
    publishing {
        publications.withType<MavenPublication>().names // [jvm, kotlinMultiplatform, metadata]
    }
    Should I just manually set it to not publish the
    metadata
    artifact, or will it be ignored during the publish task?
    ➕ 1
    b
    • 2
    • 1
  • b

    BollywoodVillain

    11/25/2020, 12:54 PM
    Kotlin Multiplatform fails on iOS while calling Ktor suspend functions. The error is
    kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen
    . It works fine on Android and gets the network data without issues. I created a brand new MPP project using Android Studio MPP template and added the Ktor network code from Ktor-sample/client-mpp repo. What could be the problem? The complete project is on Github at: https://github.com/samkhawase/Kotlin_MPP_Demo. I’m using ktor
    1.4.2
    , Kotlin
    1.4
    , Kotlin plugin
    1.4.20-release-Studio4.1.1
    , and KMM plugin
    0.2.0-release-65-Studio4.1
    . Here’s a snapshot of my
    sourceSets
    from
    build.gradle.kt
    (:shared)
    val ktor_version = "1.4.2"
        sourceSets {
            val commonMain by getting {
                dependencies {
                    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1")
                    implementation("io.ktor:ktor-client-core:$ktor_version")
                    implementation("io.ktor:ktor-client-serialization:$ktor_version")
                }
            }
            val commonTest by getting {
                dependencies {
                    //... 
                    implementation("io.ktor:ktor-client-core:$ktor_version")
                }
            }
            val androidMain by getting {
                dependencies {
                    //... 
                    implementation("io.ktor:ktor-client-android:$ktor_version")
                    implementation("io.ktor:ktor-client-serialization-jvm:$ktor_version")
                }
            }
            val androidTest by getting {
                dependencies {
                    //... 
                    implementation("io.ktor:ktor-client-android:$ktor_version")
                }
            }
            val iosMain by getting {
                dependencies {
                    implementation("io.ktor:ktor-client-ios:$ktor_version")
                    implementation("io.ktor:ktor-client-serialization:$ktor_version")
                }
            }
            val iosTest by getting {
                dependencies {
                    implementation("io.ktor:ktor-client-ios:$ktor_version")
                    implementation("io.ktor:ktor-client-serialization:$ktor_version")
                }
            }
        }
    Here’s the failing Swift code
    func getLocations() {
            let apiService = ApiService()
            apiService.about { (htmlString) in
                print("🦋 htmlString:\n \(htmlString)")
            }
    }
    
    struct ContentView: View {
        var body: some View {
            Text(greet()).onAppear {
                print("isMainThread: \(Thread.isMainThread)")
                getLocations()
            }
        }
    }
    Here’s the complete stacktrace from the iOS app.
    c
    a
    +2
    • 5
    • 59
  • b

    BollywoodVillain

    11/25/2020, 12:54 PM
    isMainThread: true
    Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError.
    It is considered unexpected and unhandled instead. Program will be terminated.
    Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen com.berlin.kmm_demo.shared.ApiService@2a37878
        at 0   shared                              0x0000000100c192dd kfun:kotlin.Throwable#<init>(kotlin.String?){} + 93 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Throwable.kt:23:37)
        at 1   shared                              0x0000000100c121cb kfun:kotlin.Exception#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:23:44)
        at 2   shared                              0x0000000100c1238b kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:34:44)
        at 3   shared                              0x0000000100c4793b kfun:kotlin.native.concurrent.InvalidMutabilityException#<init>(kotlin.String){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt:22:60)
        at 4   shared                              0x0000000100c491f2 ThrowInvalidMutabilityException + 690 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt:92:11)
        at 5   shared                              0x0000000100d4136c MutationCheck + 108
        at 6   shared                              0x0000000100bb7ce7 kfun:com.berlin.kmm_demo.shared.ApiService#<init>(){} + 455
        at 7   shared                              0x0000000100bbc743 objc2kotlin + 163
        at 8   iosApp                              0x0000000100ae655f $sSo16SharedApiServiceCABycfC + 31
        at 9   iosApp                              0x0000000100ae6467 $s6iosApp12getLocationsyyF + 39 (/Users/skhawase/skunkworks/KMM_Demo/iosApp/iosApp/ContentView.swift:13:1)
        at 10  iosApp                              0x0000000100ae6eaa $s6iosApp11ContentViewV4bodyQrvgyycfU_ + 442 (/Users/skhawase/skunkworks/KMM_Demo/iosApp/iosApp/ContentView.swift:20:9)
        at 11  SwiftUI                             0x00007fff55f13d0c $sIeg_ytIegr_TR + 12
        at 12  SwiftUI                             0x00007fff55e22b01 $sIeg_ytIegr_TRTA + 17
        at 13  SwiftUI                             0x00007fff55f13d2c $sytIegr_Ieg_TR + 12
        at 14  SwiftUI                             0x00007fff55f13d0c $sIeg_ytIegr_TR + 12
        at 15  SwiftUI                             0x00007fff55e22b01 $sIeg_ytIegr_TRTA + 17
        at 16  SwiftUI                             0x00007fff55e22c09 $sIeg_ytIegr_TRTA.8 + 9
        at 17  SwiftUI                             0x00007fff5636e239 $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtFyyXEfU_ + 1657
        at 18  SwiftUI                             0x00007fff5636d2f7 $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtF + 343
        at 19  SwiftUI                             0x00007fff564d4e41 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyF + 241
        at 20  SwiftUI                             0x00007fff564d4e65 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyFTo + 21
        at 21  UIKitCore                           0x00007fff24bcd686 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2874
        at 22  QuartzCore                          0x00007fff27a5ae67 -[CALayer layoutSublayers] + 258
        at 23  QuartzCore                          0x00007fff27a61319 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 575
        at 24  QuartzCore                          0x00007fff27a6d071 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 65
        at 25  QuartzCore                          0x00007fff279ad158 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 496
        at 26  QuartzCore                          0x00007fff279e3ef3 _ZN2CA11Transaction6commitEv + 783
        at 27  UIKitCore                           0x00007fff2468ab96 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 81
        at 28  CoreFoundation                      0x00007fff203a85db __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
        at 29  CoreFoundation                      0x00007fff203a79ef __CFRunLoopDoBlocks + 434
    
    Process finished with exit code 0
    m
    • 2
    • 2
  • a

    Amritansh

    11/25/2020, 10:16 PM
    I am getting
    Execution failed for task ':shared:cinteropAFNetworkingIosArm64'.> Process 'command '/Applications/Android Studio 2.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
    when I am adding a pod
    cocoapods {
        pod(name ="AFNetworking", version = "~> 4.0.1")
    }
    Anyone seen this before?
    a
    • 2
    • 1
  • f

    František Hlinka

    11/25/2020, 10:54 PM
    Hey guys! We’re using the
    ios()
    target shortcut inside the
    kotlin {…}
    block in
    build.gradle.kts
    to create iOS targets for simulator and device and use the same
    iosMain
    source set. However, the dependencies of the iOS target do not get resolved correctly in the IDE (specifically speaking, the
    Platform
    object, or SQLDelight’s
    NativeSqliteDriver
    ). If hierarchical project structure is disabled - e.g.
    gradle.properties
    does not include
    kotlin.mpp.enableGranularSourceSetsMetadata=true
    kotlin.native.enableDependencyPropagation=false
    , then the project builds anyway even if the IDE can’t resolve the classes. If I add those two lines, the build fails too. This is happening on Kotlin 1.4.10 and 1.4.20. Does anyone know what’s the problem or where should I open an issue? Thanks lots!
    r
    a
    • 3
    • 6
  • n

    Nikolay Kasyanov

    11/26/2020, 3:54 PM
    Hey folks, I have a feeling this must be a known issue. Here’s what happens: I have a KMP project and as soon as I have built something, IDEA (or Android Studio) starts using built artifacts (jar, class files) for code highlighting and navigation in the editor. For example, it starts falsely reporting some imports as unreachable because of classes being internal (although actual build works flawlessly, meaning internal is just fine). When you cmd-click the import, it shows a decompiled version of it instead of the source code. It definitely happens with types from
    commonMain
    when imported in files residing in
    jvmTest
    . Doing
    ./gradlew clean
    solves the problem (editor navigation starts using source code, red highlighting of imports goes away) until next build. IDEA CE 2020.3 beta or 2020.2.4, Kotlin plugin 1.4.20.
    💪🏽 1
    c
    s
    • 3
    • 20
  • t

    tjohnn

    11/27/2020, 8:07 AM
    Hey guys, any advice on mocking in commonTest? I tried mockk without success
    k
    a
    • 3
    • 3
  • v

    Vinod Rai

    11/28/2020, 6:30 AM
    Hey, Can anyone please guide or provide any link here to generate a native Universal framework with minimum size? I am generating a Universal framework and it's working perfectly but it's increasing IPA size drastically. Here is my build.gradle.kts file.
    import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
    
    plugins {
        kotlin("multiplatform")
        kotlin("plugin.serialization")
        id("com.squareup.sqldelight")
    }
    
    kotlin {
        val iosX64 = iosX64("ios")
        val iosArm64 = iosArm64("iosArm64")
        val iosArm32 = iosArm32("iosArm32")
        val frameworkName = "EmtCore"
        configure(listOf(iosX64, iosArm64, iosArm32)) {
            binaries.framework {
                baseName = frameworkName
            }
        }
        sqldelight {
            database("EmtCoreDatabase") {
                packageName = "com.emt_core.db"
            }
        }
        jvm("android")
    
        sourceSets["commonMain"].dependencies {
            implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
            implementation("io.ktor:ktor-client-core:1.4.1")
            implementation("io.ktor:ktor-client-json:1.4.1")
            implementation("com.russhwolf:multiplatform-settings-no-arg:0.6.1")
            implementation("io.ktor:ktor-client-serialization:1.4.1")
            implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9-native-mt-2")
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-rc")
            implementation("com.soywiz.korlibs.klock:klock:1.12.0")
            implementation("io.ktor:ktor-client-logging:1.4.1")
            implementation("com.squareup.sqldelight:runtime:1.4.3")
        }
    
        sourceSets["androidMain"].dependencies {
            implementation("org.jetbrains.kotlin:kotlin-stdlib")
            implementation("io.ktor:ktor-client-android:1.4.1")
            //implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9")
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-rc")
            implementation("io.ktor:ktor-client-okhttp:1.4.1")
            api("io.ktor:ktor-client-logging-jvm:1.4.1")
            implementation("io.ktor:ktor-client-json-jvm:1.4.1")
            implementation("io.ktor:ktor-client-serialization-jvm:1.4.1")
            implementation("com.squareup.okhttp3:logging-interceptor:4.4.1")
            implementation("com.squareup.sqldelight:android-driver:1.4.3")
    
        }
    
        sourceSets["iosMain"].dependencies {
            implementation("io.ktor:ktor-client-ios:1.4.1")
            //implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-rc")
            implementation("io.ktor:ktor-client-json-native:1.3.2")
            api("io.ktor:ktor-client-logging-native:1.3.2")
            implementation("io.ktor:ktor-client-serialization-iosx64:1.4.1")
            //implementation("io.ktor:ktor-client-serialization-iosarm64:1.4.0")
            implementation("com.squareup.sqldelight:native-driver:1.4.3")
        }
    
        sourceSets["iosArm64Main"].dependencies {
            implementation("io.ktor:ktor-client-ios:1.4.1")
            //implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-rc")
            implementation("io.ktor:ktor-client-json-native:1.3.2")
            api("io.ktor:ktor-client-logging-native:1.3.2")
            implementation("io.ktor:ktor-client-serialization-iosarm64:1.4.1")
            //implementation("io.ktor:ktor-client-serialization-iosarm64:1.4.0")
            implementation("com.squareup.sqldelight:native-driver:1.4.3")
        }
    
        sourceSets["iosArm32Main"].dependencies {
            implementation("io.ktor:ktor-client-ios:1.4.1")
            //implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-rc")
            implementation("io.ktor:ktor-client-json-native:1.3.2")
            api("io.ktor:ktor-client-logging-native:1.3.2")
            implementation("io.ktor:ktor-client-serialization-iosarm32:1.4.1")
            //implementation("io.ktor:ktor-client-serialization-iosarm64:1.4.0")
            implementation("com.squareup.sqldelight:native-driver:1.4.3")
        }
    
        val debugFatFramework by tasks.creating(org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask::class) {
            baseName = frameworkName
            from(
               iosArm32.binaries.getFramework("debug"),
                iosArm64.binaries.getFramework("debug"),
                iosX64.binaries.getFramework("debug")
            )
            destinationDir = buildDir.resolve("fat-framework/debug")
            group = "Universal framework"
            description = "Builds a debug universal (fat) framework"
        }
    
        val releaseFatFramework by tasks.creating(org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask::class) {
            baseName = frameworkName
            from(
                iosArm32.binaries.getFramework("release"),
                iosArm64.binaries.getFramework("release")
            )
            destinationDir = buildDir.resolve("fat-framework/release")
            group = "Universal framework"
            description = "Builds a release universal (fat) framework"
        }
    
        val zipDebugFatFramework by tasks.creating(Zip::class) {
            dependsOn(debugFatFramework)
            from(debugFatFramework)
           // from("LICENSE.md")
        }
    
        val zipReleaseFatFramework by tasks.creating(Zip::class) {
            dependsOn(releaseFatFramework)
            from(releaseFatFramework)
            //from("LICENSE.md")
        }
    }
    k
    r
    • 3
    • 3
  • e

    Elyes Ben Salah

    11/28/2020, 12:15 PM
    Hey guys , I just started exploring KMM and I’m new with Kotlin also , and I would like to know if I can work with a Java Library in the common project ( we have our SDK in JAVA) or better to re-write it in Kotlin
    j
    u
    • 3
    • 3
  • a

    Azur Haljeta

    11/28/2020, 1:47 PM
    The
    frameworkName
    specified in
    cocoapods{}
    is ignored when building the
    .podspec
    file via
    ./gradlew podspec
    . It uses the name of the gradle project, which is also the default value. Any ideas?
    a
    • 2
    • 9
  • a

    andylamax

    11/28/2020, 6:59 PM
    Hello all, can I setup a Multiplatform lib with a jvm target where,
    jvmMain
    contains kotlin code, while
    jvmTest
    contains kotlin and java code? andy gradle sample?
    • 1
    • 1
  • o

    outadoc

    11/28/2020, 9:05 PM
    Hey all, I’m trying to get a small multiplatform project going, and I’m seeing some weird errors in the IDE. The project builds fine, but both IntelliJ 2020.2.4 and Android Studio 4.1.1 show errors every time I import something from a multiplatform library. There are two multiplatform libs,
    lib-kemu
    , and
    lib-chip8
    (which depends on
    lib-kemu
    locally). Then two multiplatform modules,
    app-chip8-desktop
    (Kotlin/JVM) and
    app-chip8-browser
    (Kotlin/JS) which depend on
    lib-chip8
    . There’s a chance that I’m doing something wrong, but if that’s the case I cannot figure out what. And it’s getting really hard to progress with every line being errored out. 😞 The code is here: https://github.com/outadoc/kemu-chip8
    g
    • 2
    • 3
  • k

    Kuba Petržílka

    11/28/2020, 9:37 PM
    Hi. I have a multiplatform Spring JVM/React Browser JS project whre I use some kind of RestClient which is my custom coroutine-based wrapper over Spring's HttpTemplate in the JVM part and wrapper over window.fetch in the JS part. I was considering to replace the SpringTemplate with the new Java 11 HttpClient and create some common expected interface for it and extract it to a separate lightweight but multiplatform-enabled RestClient library. But maybe there is already something like that around I just cannot find it. Do you know?
    d
    k
    • 3
    • 5
  • j

    Jide

    11/29/2020, 10:00 AM
    Hi. I keep getting this error whenever I try adding a pod dependency to my project. Can anyone help? Note: I have cocoapods and cocoapods-generate installed
    a
    a
    a
    • 4
    • 8
  • c

    Cicero

    11/30/2020, 1:50 PM
    A library right I was wondering about this. In the past when my project was going to happen in React Native I wrote a node library for connectivity and models Is it similar to a node library? Could I also export my network from common as a library? Also brings me to another question, would I to be able to work in my common without having all this android stuff around? I would like to, for example, run my common independently.
    s
    • 2
    • 3
  • n

    nrobi

    11/30/2020, 1:58 PM
    [KMM] Those who are sharing ViewModels and using SwiftUI on iOS, how do you approach disposing background jobs? I’m exposing a
    dispose()
    and calling it from my
    ObservableObject
    ’s
    deinit
    method (which represents my view’s state and essentially wraps my ViewModel while publishing the state to the view). Any thoughts if there is a better way?
    ➕ 1
    z
    t
    a
    • 4
    • 6
  • j

    Javier

    11/30/2020, 3:07 PM
    I have a jvm module which is implementing a kotlin multiplatform module that only have jvmMain target. The build is working perfectly and all tests pass. But if I go to some file inside the jvm module, I see that all referecences from jvm multiplatform module are unresolved, anyone know why this is happening?
    m
    m
    +2
    • 5
    • 24
  • p

    Philip Dukhov

    12/01/2020, 1:06 AM
    Does anyone use cocoapods dependencies generated code in kotlin? It works fine, but even after I finished my module, that had dependencies, and don’t change it anymore, each time I change project gradle file, my module with pod dependencies invalidates cache for
    cinterop
    tasks and run them, and it takes a lot of time. Any way to really cache them? As I understand those create kotlin headers for the libraries. Obviously I only need those to be run when dependencies or a config related to them changed. But now even when those tasks finished and I run build from
    Xcode
    it doesn’t use the cache and rebuild it again and again.
    b
    • 2
    • 1
  • f

    Frankablu

    12/01/2020, 1:32 AM
    How do I remove a target from a multiplatform gradle file? I've commented out all the native lines but I'm getting "Task 'nativeMainBinaries' not found in root project 'GoalTradeOffsMP'."
    • 1
    • 1
  • a

    Animesh Sahu

    12/01/2020, 8:10 AM
    Something weird is happening with me. The commonMain seems to have "kotlin not configured" error while the other modules have no problems for it... Any idea?
    • 1
    • 3
  • a

    aleksey.tomin

    12/01/2020, 8:16 AM
    Can I perform syntax check mingw code on macOS host? macos/mingw code on linux host? I don’t want to build result - I want only syntax check.
    🇳🇴 1
    s
    • 2
    • 2
  • c

    Cicero

    12/01/2020, 10:35 AM
    Is there a way, besides writing in ios and android, to securely store data in the common without external libraries? A friend of mine said something about storing in secrets but when googling it I didn’t found anything
    g
    • 2
    • 2
  • d

    Daniele B

    12/01/2020, 2:48 PM
    Sharing a slide I am preparing for my next talk, putting KMP and JetpackCompose and SwiftUI on a timeline
    💡 1
    👍 3
    r
    s
    +3
    • 6
    • 44
  • t

    Tristan Blakers

    12/01/2020, 11:35 PM
    does anyone know of a multiplatform URL representation, with basic parsing capability? Ktor has one, but it's too heavy to drag into the browser for just one class...
    e
    b
    • 3
    • 16
  • s

    solidogen

    12/01/2020, 11:37 PM
    JVM backend module sees common classes only inside androidMain - like commonMain and jvmMain do not exist. JS app and Android app modules work fine with commonMain code. Any idea what could go wrong? Android Studio tells me to add dependency on common.commonMain, but of course it doesn't work
    m
    • 2
    • 3
  • j

    Jeff Tycz

    12/02/2020, 12:18 AM
    I have a KMP library that uses Ktor, 99.9% of the code is in the common package and the only thing in the android and ios is to set the ktor engine. I am not sure about how to provide the necessary dependencies to be used for my library to be used in ios and android. do I have to build a gradle dependency for ios and android just to get the ktor engine and then the common dependency with all the code?
    e
    s
    • 3
    • 10
  • p

    Paul Woitaschek

    12/02/2020, 8:16 AM
    We are having issues with type inference. I just added the watchos targets as well as the io targets and created a common source set for them (with the hierachical structure enabled). Now the code accessing NSDateComponents does no longer compile. https://developer.apple.com/documentation/foundation/nsdatecomponents/1411355-hour The issue is that
    NSDateComponents().hour
    is a
    Long
    in the iosX64Main source set and a
    Int
    in the
    watchOsArm64Main
    source set. Is there any way around that?
    t
    e
    • 3
    • 2
  • j

    João Rodrigues

    12/02/2020, 1:25 PM
    Hey everyone 👋 I've been experimenting with kotlin multiplatform, and following the hands on has been really helpful. However, I think that the hands on is a bit out of date, the code examples don't always match the automatically generated code by the android studio's KMM wizard. I'd really like to follow an updated version of this!
    a
    • 2
    • 1
Powered by Linen
Title
j

João Rodrigues

12/02/2020, 1:25 PM
Hey everyone 👋 I've been experimenting with kotlin multiplatform, and following the hands on has been really helpful. However, I think that the hands on is a bit out of date, the code examples don't always match the automatically generated code by the android studio's KMM wizard. I'd really like to follow an updated version of this!
a

Artyom Degtyarev [JB]

12/02/2020, 3:35 PM
Hello, @João Rodrigues! You can always share your thoughts using this hands-on’s issue tracker: https://github.com/kotlin-hands-on/kmm-networking-and-data-storage The team is always excited to get some feedback!
👀 1
✅ 1
View count: 8