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

    xxfast

    09/28/2021, 12:49 PM
    Are there any plans for a multi-platform project view support for Project explorer in Android Studio?
    :plus1: 4
    🙏 5
    d
    j
    m
    • 4
    • 6
  • j

    Jim

    09/28/2021, 5:36 PM
    Are there docs on how to target a MPP build to only use an internal npm repo like artifactory?
    • 1
    • 4
  • t

    tylerwilson

    09/28/2021, 5:49 PM
    Anybody know how to set the watchos deployment target in gradle file, using the standard watchos target - that is, not using cocoapods or multiplatform-swiftpackage? I currently have this:
    watchos {
            binaries {
                framework {
                    baseName = "common"
                    embedBitcode("bitcode")
                    xcf.add(this)
                }
            }
        }
    k
    • 2
    • 1
  • j

    Jim

    09/28/2021, 6:15 PM
    I’m re-phrasing my previous question in a new question since I thought I had a solution but didn’t. It looks like
    kotlinNodeJsSetup
    is using https://nodejs.org/dist, is there a way I can prevent it from using that url and instead use an internal repository?
    h
    • 2
    • 4
  • m

    Matti MK

    09/29/2021, 5:57 AM
    Is there any established best practice thus far as to how data is passed from a shared module to native apps, let’s say in case of POJO from a network response? I’ve used to using Flows for pure Android development, the KMM prod sample uses a wrapper around the Flows (https://github.com/Kotlin/kmm-production-sample#native-ui), is this an approach to consider?
    k
    m
    • 3
    • 10
  • r

    Ran

    09/29/2021, 7:36 AM
    The dynamic framework size is a huge obstacle to use KMM.
    b
    • 2
    • 4
  • f

    Fabio Bombardi

    09/29/2021, 9:13 AM
    Hi guys! Could someone help me with this two: https://youtrack.jetbrains.com/issue/KT-48920 and https://youtrack.jetbrains.com/issue/KT-48932
    f
    • 2
    • 2
  • r

    robjperez

    09/29/2021, 9:15 AM
    Hi!, I’m having some problems when trying to run some integration tests in iOS Devices: • I have code that is different when running on the simulator or the device, so I have these folders ◦ iosMain (95% of my code) ◦ iosTest ◦ iosArm64Main (that 5% of the code which is specific for the device, uses Metal) ◦ iosX64Main (same 5% of the code which is in OpenGL because sim does not support Metal) • In order to make this work, I had to add this to build gradle file (this was suggested in this channel 🙂 )
    val isIdeaSyncing = System.getProperty("idea.sync.active") != null
        if (isIdeaSyncing) {
            iosX64("ios")
        } else {
            ios()
            iosX64()
            iosArm64()
        }
    Well, with that, when I try to run a test in
    iosTest
    folder I got this error
    FAILURE: Build failed with an exception.
    * What went wrong:
    Task 'cleanIosTest' not found in project ':sdk'.
    Probably because on how I define the targets, but If remove above’s snippet with the iOS targets, then the code which is exclusive for simulator or device is not built Any clues?? Thank you!
    l
    • 2
    • 2
  • h

    Hossein Amini

    09/29/2021, 9:24 AM
    Hi, what is the proper way to upload an image on Android and iOS using Ktor? I couldn’t find a source code or sample. Also documentation hasn’t explained to how to create a File and convert it to the ByteArray on Android and iOS
    s
    e
    • 3
    • 5
  • p

    Piotr Krzemiński

    09/29/2021, 9:42 AM
    Hi all! I have a Kotlin-based frontend project using React, and now I want to extract DTOs to a multiplatform Gradle module. The problem is that now in runtime, I'm getting:
    Uncaught TypeError: e.defineModule is not a function
    . When looking into my bundle,
    e.defineModule
    occurs only once in such context:
    e.defineModule("kotlinx-serialization-kotlinx-serialization-core-jsLegacy",t)
    Indeed I want to use kotlinx.serialization. This happens on legacy JS backend, and on IR some misterious
    ClassCastException
    occurs at runtime (maybe more changes would be required to make the project work with IR).
    ✅ 1
    • 1
    • 2
  • r

    Ran

    09/29/2021, 10:05 AM
    Hi guys, Is there anyone can help me to solve this problem https://discuss.kotlinlang.org/t/gradle-task-embedandsignappleframeworkforxcode-for-xcode-run-failed-all-the-time/23062?u=jeromeran
    t
    • 2
    • 2
  • x

    xiaobailong24

    09/29/2021, 11:04 AM
    https://kotlinlang.org/docs/native-cocoapods.html#add-a-dependency-on-a-pod-library-from-the-cocoapods-repository Hello, I try to add a dependency on pod library(AFNetworking) to KMM shared moudle by CocoaPods integration, but get the below error: fatal error: module 'AFNetworking' not found, how to fix it? Thx!
    k
    b
    • 3
    • 7
  • k

    KamilH

    09/29/2021, 11:41 AM
    I’m having a very similar problem like the one described above, but with the different dependency (
    Ably
    ). My gradle sync fails on
    cinterop
    task (
    shared:cinteropAblyIos
    to be specific) with the message:
    Exception in thread "main" java.lang.Error: /var/folders/2q/gjhd6ng16j51tnmw772w02k40000gp/T/5129966869508006261.m:1:9: fatal error: could not build module 'Ably'
    I tried to check whether I’m able to import some other cocoapods dependency and for example I can import
    AFNetworking
    and use it, but when I try to import Ably it doesn’t work What is the reason it fails? It’s something wrong with the dependency itself?
    x
    m
    b
    • 4
    • 13
  • w

    Waqas Tahir

    09/29/2021, 5:07 PM
    don't know if I should post this in multiplatform
    s
    a
    • 3
    • 3
  • a

    Alfred Lopez

    09/30/2021, 12:11 AM
    Hello, What is the alternative to @JsExport a function with a [Mutable]Map<String, String>? I'm getting a Exported declaration uses non-exportable parameter type: Map<String, String> error on functions that have Map as parameters. Thanks
    t
    a
    • 3
    • 9
  • h

    Hamza Ahmad

    09/30/2021, 7:57 AM
    Hello everyone, i'm working in KMM and use ktor library for 'http calls' , but when called server request I got exception and it says "Exception in http request: Error Domain = NSURlErrorDomain Code = -1202 'The certificate for this server is invalid.'" and ktor only calls request that have url with https is there any solution to call server request with simple http instead of https?
    j
    • 2
    • 4
  • i

    Ivanna Vasilkova

    09/30/2021, 8:33 AM
    Hello, guys! Im trying to find out library for loading configuration files into typesafe classes for kmm. Is there such a library , or we can do it another way? Thanks for attention.
    k
    b
    • 3
    • 2
  • a

    Alfred Lopez

    09/30/2021, 4:08 PM
    Hi, I'm trying to use LinkedHashMap from JavaScript (Typescript, really) and I have the following in my code...
    const kotlin = require("kotlin");
    
    ...
    
    let identityContext = new kotlin.kotlin.collections.LinkedHashMap()        
    identityContext.put("mYKey","myValue");
    but when I run this, I get the following error: TypeError: identityContext.put is not a function When I look at kotlin.js, I see the following definition of "put":
    LinkedHashMap.prototype.put_xwzc9p$ = function (key, value)
    I see that LinkedHashMap is an expect class, so I assumed that there's a JavaScript accept class with proper @JsName declarations. Is this not the case? Do I need to use the mangled function name? Thanks
    c
    • 2
    • 5
  • h

    hsyogesh

    09/30/2021, 4:22 PM
    Hi all can we do a poc on Kotlin multiplatform in windows to verify only on Android, I understand we cannot for iOS as xcode is prerequisite
    c
    l
    • 3
    • 6
  • j

    Jan

    09/30/2021, 5:36 PM
    Hey! I wrote a kotlin multiplatform library and wanted to test it on the jvm side. But IntelliJ gives me a "Cannot access XY, Check for missing dependencies" error and I can't compile. Its probably something with the publishing because if I add the dependencies manually, it works. I can see the dependecies in "External Libraries" in Intellij Build file from the MP project: https://github.com/jan-tennert/DiscordKM/blob/master/build.gradle.kts Error: (see thread)
    • 1
    • 3
  • a

    Anton Afanasev

    09/30/2021, 6:41 PM
    Hi. What do you do with high binary sizes on iOS? I have watched this talk

    https://www.youtube.com/watch?v=hrRqX7NYg3Q&amp;t=1892s▾

    from Kevin Galligan from a year ago. Wondering if anybody knows anything about progress on reducing the sizes, K\N-Swift interop
    k
    b
    • 3
    • 10
  • m

    Marco Righini

    09/30/2021, 7:36 PM
    Hi everyone. Do you have some advices on courses/books to help iOS developers join multiplatform? In particular someones related to the following topics: • Kotlin for iOS (Swift) developers • Kotlin Multiplatform for iOS developers Thanks!
    k
    • 2
    • 5
  • b

    Brian G

    10/01/2021, 12:00 AM
    I just want to share a little KMM success story, if anyone is interested! A little while ago I joined a small company as their sole Android developer. They were writing essentially the same app in 3 codebases, one for Android (Java), iOS (ObjC), and JavaScript. The three of us would coordinate changes between the three code bases. Since joining, I rewrote the entire Android app in Kotlin, integrated kotlin multiplatform, and added Web (written in Kotlin) and iOS (written in Swift) view layers. I now ship Android, Web, and iOS clients myself, all from one codebase, turning 3 developer's jobs into one! They are pretty happy with the outcome. Our current breakdown is about 65% common code / 35% platform code. Thank you Kotlin devs and Jetbrains for such an amazing tool 🙂
    :kotlin-intensifies: 18
    :nice: 10
    🎉 18
    l
    j
    u
    • 4
    • 8
  • h

    Hamza Ahmad

    10/01/2021, 7:05 AM
    Hello, i'm using ktor for http requests and my response come in the below format how i can deserialize and get value from "strDefaultValue" property.
    c
    • 2
    • 1
  • d

    deviant

    10/01/2021, 10:14 AM
    guys, is it possible to write tests in the
    commonTest
    ? what platform will run it?
    g
    m
    • 3
    • 16
  • d

    Diana M

    10/01/2021, 4:13 PM
    Hi! I upgraded my project from Kotlin 1.3.71 to 1.5.31 and gradle to 7.2. I now see an error when building the iOS framework. The project uses FatFrameworkTask. Error:
    * What went wrong:
    Could not determine the dependencies of task ':linkReleaseFrameworkIos'.
     > Collection is empty.
      * Try:
       Run with --scan to get full insights.
      
      * Exception is:
      org.gradle.api.internal.tasks.TaskDependencyResolveException: Could not determine the dependencies of task ':linkReleaseFrameworkIos'.
     at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:71)
     at org.gradle.execution.plan.TaskDependencyResolver.resolveDependenciesFor(TaskDependencyResolver.java:46)
     at org.gradle.execution.plan.LocalTaskNode.getDependencies(LocalTaskNode.java:161)
     at org.gradle.execution.plan.LocalTaskNode.resolveDependencies(LocalTaskNode.java:129)
     at org.gradle.execution.plan.DefaultExecutionPlan.doAddNodes(DefaultExecutionPlan.java:186)
    at org.gradle.execution.plan.DefaultExecutionPlan.addEntryTasks(DefaultExecutionPlan.java:150)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.addEntryTasks(DefaultTaskExecutionGraph.java:146)
    This is the build.gradle snippit:
    import org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask
    
    apply plugin: 'com.android.library'
    apply plugin: 'kotlin-multiplatform'
    apply plugin: 'maven-publish'
    
    buildscript {
        repositories {
            google()
            jcenter()
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:7.0.2'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
        }
    
        ext.ios_framework_name = 'customclassFramework'
    }
    
    repositories {
        mavenCentral()
        google()
        jcenter()
    }
    
    group 'com.xyz.testApp'
    version '0.0.1'
    
    android {
        compileSdkVersion 31
    
        defaultConfig {
            minSdkVersion 30
            targetSdkVersion 31
            versionCode 1
            versionName '1.0'
            testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        }
    
        buildTypes {
            debug {
                debuggable true
            }
            release {
                minifyEnabled true
            }
        }
    
        sourceSets {
            main {
                manifest.srcFile 'src/androidMain/AndroidManifest.xml'
                java.srcDirs = ['src/androidMain/kotlin']
                res.srcDirs = ['src/androidMain/res']
            }
        }
    }
    
    kotlin {
        targets {
            fromPreset(presets.jvm, 'android')
    
            iosX64('ios')
            iosArm32('iosArm32')
            iosArm64('iosArm64')
    
            configure([iosArm32, iosArm64, ios]) {
                binaries.framework {
                    baseName = "$ios_framework_name"
                    freeCompilerArgs += "-Xobjc-generics"
                }
            }
        }
    
        sourceSets {
            commonMain.dependencies {
                api 'org.jetbrains.kotlin:kotlin-stdlib-common'
            }
    
            androidMain.dependencies {
                api 'org.jetbrains.kotlin:kotlin-stdlib'
            }
    
            iosMain.dependencies { }
    
            configure([iosArm32Main, iosArm64Main]) {
                dependsOn iosMain
            }
    
            configure([iosArm32Test, iosArm64Test]) {
                dependsOn iosTest
            }
        }
    
        task releaseFatFramework(type: FatFrameworkTask) {
            baseName = ios_framework_name
    
            destinationDir = file("$projectDir/xcode-framework")
    
            from(
                targets.ios.binaries.getFramework("RELEASE"),
                targets.iosArm32.binaries.getFramework("RELEASE"),
                targets.iosArm64.binaries.getFramework("RELEASE")
            )
    
            doLast {
                new File(destinationDir, 'gradlew').with {
                    text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
                    setExecutable(true)
                }
            }
        }
    }
    
    configurations {
        compileClasspath
    }
    
    publishing {
        repositories {
            maven {
                url "<path/to/private/maven>"
                name 'customclass'
                credentials {
                    username = "${vsts_user_publish}"
                    password = "${vsts_password_publish}"
                }
            }
        }
    
        publications {
            maven(MavenPublication) {
                groupId = 'com.xyz.testApp'
                artifactId 'customclass'
                version = version
                artifact ("${project.buildDir}/outputs/aar/${project.name}-release.aar")
            }
        }
    }
    
    tasks.build.dependsOn releaseFatFramework
    :thread-please: 3
    s
    • 2
    • 1
  • a

    Alfred Lopez

    10/01/2021, 7:08 PM
    Hi, What are some strategies I can employ to change my runBlocking code to async/await so that it can be compiled to JS? Thanks!
    m
    c
    +2
    • 5
    • 71
  • f

    Francis Mariano

    10/01/2021, 7:41 PM
    Hello everyone: I have problem with coroutine when I try use
    native-mt
    on iosMain module. Code in thread
    m
    a
    • 3
    • 6
  • s

    spierce7

    10/02/2021, 4:26 AM
    I’m having trouble resolving an expect/actual declaration from another local gradle module in my project. Either I can see it in the common code, but not in the native sourceset or vice versa. Anyone know the best way to resolve problems like this? @russhwolf You gave me the recommended settings to resolve problems like this a 4 or 5 months ago. Has anything changed regarding this?
    r
    • 2
    • 6
  • a

    Akram Bensalem

    10/03/2021, 5:39 PM
    How we can integrate FireBase sdk to Compose Desktop ?
    m
    • 2
    • 1
Powered by Linen
Title
a

Akram Bensalem

10/03/2021, 5:39 PM
How we can integrate FireBase sdk to Compose Desktop ?
m

Martin Rajniak

10/03/2021, 7:48 PM
Firebase doesn't support desktop. The only way how I was thinking about integrating it in desktop apps is through JS UI. Our desktop apps use common JS UI. And Firebase supports JS web apps.
View count: 44