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

    Anamika Trivedi

    11/07/2022, 8:31 PM
    Hi there! Is there any KMM library available for checking the network connectivity? Tried https://github.com/ln-12/multiplatform-connectivity-status but it hasn't worked well in our project.
    d
    • 2
    • 2
  • c

    Christian Würthenr

    11/08/2022, 10:14 AM
    I'm trying to make use of
    api("space.kscience:kmath-core:$version")
    but it seems to lack a
    iosSimulatorArm64
    source set. Can I somehow patch that up on my end?
    l
    p
    • 3
    • 7
  • g

    Gijs van Veen

    11/08/2022, 11:06 AM
    Im trying to upgrade my gradle to .kts, but I seem to have some issue with the publishing of my multiplatform library: old:
    afterEvaluate {
        publishing {
            publications {
                    kotlinMultiplatform { publication ->
                        artifactId = project.name
                        groupId = gradle.ext.group_id
                        version = gradle.ext.library_version
                    }
                }
            }
        }
    }
    new:
    afterEvaluate {
        publishing {
            publications {
                        getByName("kotlinMultiplatform") {
                            (this as MavenPublication).let {
                                artifactId = name
                                groupId = Library.group
                                version = Library.version
                            }
                        }
            }
        }
    }
    All the jars etc seem to be generated just fine, but on the new implementation I dont get a root folder for the artifact, even though kotlin documentation specifies:
    Some repositories, such as Maven Central, require that the root module contains a JAR artifact without a classifier, for example kotlinMultiplatform-1.0.jar.
    The Kotlin Multiplatform plugin automatically produces the required artifact with the embedded metadata artifacts.
    This means you don't have to customize your build by adding an empty artifact to the root module of your library to meet the repository's requirements.
    https://kotlinlang.org/docs/multiplatform-publish-lib.html#structure-of-publications What could I be doing wrong?
    n
    • 2
    • 2
  • a

    Ashu

    11/08/2022, 11:10 AM
    Can anyone point me to a resource explaining setting up ksp with kotlin mobile multiplatform? I am trying to add it for koin.
  • o

    Oscar Fuentes

    11/08/2022, 1:41 PM
    Hi, I’m trying to add a table in my sqldelight schema but the app doesn’t update the database schema I even try deleting the data and uninstalling the app but it still remain the old Schema, Is there a way to force the upgrade of the schema? (like the “version” in Realm) Strange thing is that if I check the generated class “DatabaseImpl” it has the correct generation of tables, and if I change the name of the database it works as intended (generate the new schema) but if I use the same name the table is not there 😕 . I’m using sqldelight 1.5.3
    sqldelight{
        database("Database"){
            packageName = "package.name.datasource.cache"
            sourceFolders = listOf("sqldelight")
            verifyMigrations = true
        }
    }
    Any Ideas? The issue is happening on Android. Thanks !!
    e
    k
    • 3
    • 3
  • a

    Alex Styl

    11/08/2022, 2:09 PM
    Is it somehow possible to gain access to Platform Specific APIs from a jvm target? I have a jvm app and I would like to have access to MacOS’s native notifications (display and hide notifications for example).
    j
    • 2
    • 1
  • e

    eygraber

    11/08/2022, 8:52 PM
    I'm trying to create a custom compilation for the metadata target, but I'm getting an error that says
    Can't create custom metadata compilations by name
    . I'm doing:
    kotlin {
      targets {
        getByName("metadata") {
          compilations.create("testUtils")
        }
      }
    }
    I'm trying to do this because I have a
    commonTest
    sourceSet that has a mix of tests and utils in it. I also have a custom jvm compliation for benchmarks that relies on the utils in
    commonTest
    . I can't add
    commonTest
    output classfiles as a dependency because then it brings in the common tests, which I do not want. Any ideas other than creating separate modules for all of these things?
    • 1
    • 1
  • x

    xxfast

    11/09/2022, 2:56 AM
    Hi. I'm planning to modularise my kmp library and I wish to replicate the same build configurations in
    /module/build.gradle.kts
    across all my modules. Whats the best way to do this? Do I have to use
    buildSrc
    in order to achieve this?
    j
    p
    • 3
    • 4
  • g

    Gellért Biró

    11/09/2022, 7:52 AM
    Is there someone with experience with Objective-C - Kotlin interoperability in KMM? I am trying to invoke an Objective-C function that takes a parameter with the following type:
    CValuesRef<CPointerVar<ifaddrs>>
    This supposed to be a pointer but I have no idea how to create something like that in Kotlin.
    j
    • 2
    • 1
  • i

    Ivan

    11/09/2022, 2:47 PM
    Hi, I have a strange issue with cocoapods integration that I hope someone can give some insight into. We've been working on a kmm project and development has been going well. Now we want to set up the analytics so in the
    build.gradle
    cocoapods
    block, we added
    pods("FirebaseAnalytics")
    . Adding the pod work fine and Analytics is working, but now Xcode has lost all reference to my shared project, none of the autocomplete works and it's full of errors about none of my
    shared
    classes are in the scope. From my investigation, after gradle runs its magic, it's supposed to generates a framework of my
    shared
    module at path
    build/cocoapods/framework
    . Inside the framework, there's supposed to be a
    shared.framework/Headers/shared.h
    where all the
    shared
    module's headers are. But the issue is that after I add the
    pod()
    function inside the
    cocoapods
    block, the framework only contains a
    placeholder.h
    file inside the Headers folder which is only contains this single line
    // Autogenerated placeholder header. Do not edit manually.
    The strange thing is while Xcode is filled with errors, I can actually build and run the app perfectly fine. Also if I remove the
    pods("FirebaseAnalytics")
    , everything is back to normal,
    shared.h
    is back in the Headers folder instead of
    placeholder.h
    . Any ideas how to resolve this issue?
    l
    • 2
    • 5
  • r

    Rodrigo Castrillón Restrepo

    11/09/2022, 7:34 PM
    Hi guys, does anyone know the reason for the error?
    s
    • 2
    • 2
  • s

    Sam Gammon

    11/10/2022, 4:01 AM
    hello new friends
  • s

    Sam Gammon

    11/10/2022, 4:01 AM
    i am working on a Kotlin Multiplatform web framework and am looking for people who are interested in collaborating / sharing ideas 🙂
    n
    • 2
    • 19
  • h

    Hasan Nagizade

    11/10/2022, 9:40 AM
    I have same dependency for androidApp and commonMain I am getting Duplicate class error. How can I fix this?
    z
    • 2
    • 1
  • e

    Eugene Maksymenko

    11/11/2022, 10:17 AM
    WorldWind Kotlin 1.1.0 released! Start your KMP map application today with the first open-source multi-platform 3D globe SDK. A bunch of stability fixes implemented. https://github.com/WorldWindEarth/WorldWindKotlin/releases/tag/v1.1.0
  • t

    Tolriq

    11/11/2022, 10:38 AM
    Is there already some kind of consensus about translations sharing in multiplaform apps?
    v
    a
    • 3
    • 3
  • v

    veyndan

    11/11/2022, 11:38 AM
    Hi all! Just published Multiplatform Paging, a library that packages AndroidX Paging for Kotlin/Multiplatform. It’s built to be a drop-in-replacement for AndroidX Paging, so extracting out shared pagination logic couldn’t be easier. Please check it out if you're interested! Introductory blog post: https://code.cash.app/announcing-multiplatform-paging Repository: https://github.com/cashapp/multiplatform-paging
    m
    o
    j
    • 4
    • 8
  • m

    magnumrocha

    11/12/2022, 7:58 PM
    anyone having this Issue with Kermit 1.2.2: https://github.com/touchlab/Kermit/issues/300 ?
  • j

    Jay Upadhyay

    11/12/2022, 11:00 PM
    Hello I am new to kotlin mpp and have been following the tutorial to build a ShoppingList full stack app. I am trying to use React routes but have issues importing it. Inside of gradle I use “implementation(“org.jetbrains.kotlin-wrappers:kotlin-react-router-dom)” as per the instructions located here. https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-react-router-dom However in my Main.kt running “import react.router.dom.*” doesn’t work. Does anyone have an idea what I could be doing wrong?
  • s

    Sam Gammon

    11/12/2022, 11:13 PM
    @Jay Upadhyay did you sync IntelliJ with your gradle build? so that it picks up the new build settings
  • j

    Jay Upadhyay

    11/12/2022, 11:18 PM
    @Sam Gammon I think this may have been my issue. Thank you. I will follow up your advice.
  • s

    Sam Gammon

    11/12/2022, 11:21 PM
    @Jay Upadhyay you can always tell this is the issue if
    ./gradlew build
    works, but IntelliJ doesn't find it
  • s

    Sam Gammon

    11/12/2022, 11:21 PM
    good luck! 🙂
  • a

    Anmol Verma

    11/13/2022, 5:21 AM
    Fixed: Thanks to https://kotlinlang.slack.com/archives/C3PQML5NU/p1666964189119009?thread_ts=1666957404.758489&amp;cid=C3PQML5NU I am writing a kotlin multiplatform library, I have included the framework in my cocoapods block but when i build I get the following error
    /Users/anmolverma/IdeaProjects/****/***-lib/build/cocoapods/synthetic/IOS/Pods/Pods.xcodeproj: 
    error: Signing for "gRPC-gRPCCertificates" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'gRPC-gRPCCertificates' from project 'Pods')
    j
    • 2
    • 2
  • h

    Haruki

    11/13/2022, 5:47 AM
    Hi, I am doing the tutorial to build a ShoppingList full stack app, and I was wondering how to add a class/id attribute for HTML on App.kt. For example,
    h1 {+"Full-Stack Shopping List"}
    -> I want to write something like this:
    h1(classes="hello"){+"Full-Stack Shopping List"}
    I realized that for id, I can simply write:
    h1 {id = "hello" +"Full-Stack Shopping List"}
    . I have researched and it seems like using kotlinx.html (https://github.com/Kotlin/kotlinx.html) might be the solution. However,
    h1("hello"){+"Full-Stack Shopping List"}
    doesn't work. Does anyone know how to add a class attribute specifically in the App.kt on the tutorial. (https://kotlinlang.org/docs/multiplatform-full-stack-app.html#build-the-user-interface)?
    c
    • 2
    • 4
  • a

    Anmol Verma

    11/13/2022, 12:35 PM
    What are the different ways of importing iOS specific code into a multiplatform library project? I know we can use cocoapods but what if i want to use some github repo or custom local source ?
    m
    a
    • 3
    • 2
  • j

    jean

    11/13/2022, 9:07 PM
    I’m trying to read resource files during unit tests. I have an
    except
    function like so :
    internal expect fun readResourceFile(resourceName: String): ByteArray
    This is the jvm implementation :
    actual fun readResourceFile(resourceName: String) =
        File("./src/commonTest/resources/$resourceName").readBytes()
    I wonder how I’m supposed to implement it for my js target? I tried to use this :
    js("require('../../../resources/main/$resourceName')")
    but it complains that the string must be a constant. And the return type is
    dynamic
    which doesn’t help neither
    h
    • 2
    • 2
  • j

    Justin Xu

    11/14/2022, 1:20 AM
    Is there a way to use Aspectj in kotlin without using Spring?
  • r

    Robert Munro

    11/14/2022, 8:14 AM
    im getting a funny error when trying to setup my shared kmm module for ios dev, it seems to be looking fro watch support too. My swiftPackage config is:
    multiplatformSwiftPackage {
        packageName("shared")
        swiftToolsVersion(ver_swift_tools)
        targetPlatforms {
            iOS { v(ver_ios_deploy_target) }
        }
    }
    ./gradlew shared:createSwiftPackage
    
    > Task :shared:createXCFramework FAILED
    2022-11-14 09:04:47.772 xcodebuild[11029:493691] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    2022-11-14 09:04:47.772 xcodebuild[11029:493691] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    error: at least one framework or library must be specified.
    > Task :shared:createXCFramework FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':shared:createXCFramework'.
    > Process 'command 'xcodebuild'' finished with non-zero exit value 70
  • c

    Christian Würthenr

    11/14/2022, 9:40 AM
    I have a odd behaviour in the
    iosTest
    tests. I want to verify our certificate pinning is working fine, which requires a HTTPS request being made. Any request I make results in
    Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid."
    even with a complete vanilla setup:
    @Test
    fun WHEN_certificate_pin_is_correct_THEN_can_connect() = runBlocking {
        val client = HttpClient(Darwin)
        val status = client.get("<https://google.com>").status.value
        assertEquals(expected = 200, actual = status)
    }
    Did anyone try something like this or had similar issues before?
Powered by Linen
Title
c

Christian Würthenr

11/14/2022, 9:40 AM
I have a odd behaviour in the
iosTest
tests. I want to verify our certificate pinning is working fine, which requires a HTTPS request being made. Any request I make results in
Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid."
even with a complete vanilla setup:
@Test
fun WHEN_certificate_pin_is_correct_THEN_can_connect() = runBlocking {
    val client = HttpClient(Darwin)
    val status = client.get("<https://google.com>").status.value
    assertEquals(expected = 200, actual = status)
}
Did anyone try something like this or had similar issues before?
View count: 11