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

    Darren Bell

    07/23/2020, 11:34 AM
    Hi. Using gradle, how publish the jsJar of a project to a maven repository?
    r
    • 2
    • 5
  • f

    Friedger

    07/23/2020, 12:29 PM
    Is is possible to get some build version number or so from the gradle build file within the js or common part, like BuildConfig in Android?
    s
    s
    m
    • 4
    • 3
  • w

    wuseal

    07/24/2020, 7:32 AM
    Hi, guys? Is there any KMP library for file operating like create file/ delete file/ open file inputstream? If no, then may there KMP library for Desktop only(support MacOSX&Linux&Windows)?
    g
    k
    • 3
    • 3
  • a

    andrewreitz

    07/24/2020, 1:30 PM
    I’m trying to build for macos and I keep seeing this issue in one of my modules
    e: Compilation failed: Built-in class kotlin.Any is not found
    Any ideas? My other module builds fine and has no issues, so I can’t figure out what could possibly be wrong.
    • 1
    • 1
  • p

    Peter Hsu

    07/24/2020, 3:46 PM
    I'm having some issues with classes not being packaged into the aar output of my project with submodules. I have a submodule import with
    commonMain {
                dependencies {
                    implementation project(':common-mp')
    Within this project, is an expected class and actual definition for android. When I assemble outputs using :mainModule:assemble, the jar within the aar does not contain the source files from the common-mp project. I've tried 'api' instead of 'implementation', but that doesn't work. Am I missing something obvious?
    • 1
    • 1
  • a

    Alberto

    07/24/2020, 5:14 PM
    Is reflection handled differently between Android and iOS with Kotlin Multiplatform? Accessing the any member val from KClass returns "Unresolved reference: <name>" when building the iOS variant, but doesn't complain for the Android variant. I've tried also adding the reflect dependency in case.
    a
    s
    +5
    • 8
    • 22
  • s

    serebit

    07/25/2020, 8:46 PM
    Odd situation I had with some Kotlin 1.3.72 multiplatform code earlier: - Usage of
    MonoClock
    compiles in both common and JVM - Usage of
    Monotonic
    (imported directly from
    TimeSource
    ) compiles in both common and JVM - Usage of
    TimeSource.Monotonic
    compiles in common, but fails in JVM All three scenarios were regarded as acceptable by the IntelliJ Kotlin plugin (version 1.4-M3), but the last one failed to compile regardless.
    i
    • 2
    • 11
  • j

    janvladimirmostert

    07/25/2020, 9:33 PM
    are there any plans to allow kotlinx.serialization to only serialize / deserialize certain fields? Jackson has something like
    @JsonIgnoreProperties
    , maybe a @JsonInclude and @JsonExclude would be nice or something more generic that allows field filtering when serializing / deserializing
    a
    • 2
    • 2
  • r

    rnett

    07/26/2020, 5:51 AM
    Are there any ways or planed ways to add platforms (
    actual
    declarations) for an external library's common code? E.g. have your common module depend on the library's common, and implement it's
    expect
    definitions in your own platform module.
    k
    • 2
    • 1
  • b

    Big Chungus

    07/26/2020, 10:56 AM
    How does one setup custom sourceSet publishing? I have js and wasm sourceSets that both depend on browser sourceSet which depends on common sourceSet (also used by jvm). I want all 4 source sets published, but maven-publish ignores browser sourceSet with default settings
    r
    • 2
    • 4
  • j

    jean

    07/27/2020, 2:15 PM
    I’m trying to create a mpp project targeting the jvm for ktor and android. Where should I put the ktor gradle things like this ?
    group = "some.group.id"
    version = "0.2.0"
    
    application {
        mainClassName = "io.ktor.server.netty.EngineMain"
    }
    
    tasks.withType<ShadowJar> {
        archiveBaseName.set("some.group.id")
        archiveClassifier.set("")
        archiveVersion.set("")
    }
    Should I have a specific
    build.gradle.kts
    under
    backendMain
    (source set for my ktor backend) ?
    r
    • 2
    • 2
  • b

    Big Chungus

    07/27/2020, 10:36 PM
    Is it possible to configure KMP library targeting jvm, js, and native to publish sources and kdoc so that the users would get same hints in IDEA as they do for JVM?
    r
    • 2
    • 2
  • b

    Big Chungus

    07/28/2020, 12:52 AM
    Has anyone experienced this weird behaviour when publishing KMP lib to bintray via maven-publish - along with the version you;re publishing, there are few "empty" versions created as well, one for each platform named not with semVer, but with artifact name... e.g. 1.0.0 vs my-lib-wasm32
    s
    a
    • 3
    • 4
  • j

    Jan Stoltman

    07/28/2020, 7:57 AM
    Hey, I would like to add a .txt file to my multiplatform (android & ios) library/framework to read some data from. Is there a way to add this file as an ios resource? I know that for android I can just add it to res/raw and it will work, but I'm kinda lost at ios side.
    👍 3
    m
    • 2
    • 1
  • m

    Marc Knaup

    07/28/2020, 5:38 PM
    I have a multi-platform multi-module project. Is there any way to allow other modules of the same project to see each other’s
    internal
    declarations?
    r
    • 2
    • 4
  • s

    Sterling Albury

    07/29/2020, 2:07 AM
    Hello everyone. I’ve searched through the threads here and I know I’m not the first person to ask this, but I’m still struggling so I’m hoping to get some help. I’m currently trying to combine two shared kotlin mpp modules that use the cocoapods plugin into one framework. I just got the cocoapods sample working in the
    JetBrains/kotlin-native
    project using the
    kotlin-native-xcode-11-4-workaround
    library. I modified the
    kotlin-library
    project to have two modules, both of which are using the cocoapods plugin. I saw this thread where @Kris Wong found a project that uses a third module to aggregate things using the
    packForXCode
    task pattern, and I’ve tried to do basically the same thing but haven’t been successful getting that to work. I’ve also played with creating a fatFramework in a third module but I’m not sure I’m doing it correctly. I feel like from everything that I’ve read, this might be the best way to go. Has anyone aggregated two or more modules with cocoapods frameworks for ios targets? Would having a module that creates a fatFramework from other modules be a way to go? Should I be using the
    export
    function to export the module and the module dependecies in my ‘aggregate’ module, and then create the fatFramework? The project I’d like get to eventually would have a bunch of shared modules, some using cocoapod frameworks, some not, so I’m trying to find a good way to keep expanding on this. Thanks.
    k
    k
    • 3
    • 9
  • k

    khairil.ushan

    07/29/2020, 2:53 AM
    Hi everyone, is there any sample project repository that demonstrate all latest language feature, setup and perhaps use network and persistency library ? And maybe with kotlin coroutine
    native-mt
    r
    • 2
    • 2
  • a

    Alberto

    07/29/2020, 12:42 PM
    Hi everyone, quick question, does anyone know when Kotlin Multiplatform is expected to be promoted from "experimental" to a more "stable" release?
    g
    • 2
    • 4
  • m

    Mgj

    07/29/2020, 12:46 PM
    Im trying to set up a JVM target to run unit tests in. I have the following gradle setup:
    commonTest {
                dependencies {
                    implementation(kotlin('test-common'))
                    implementation(kotlin('test-annotations-common'))
                }
            }
            jvmTest {
                def mockk_version = "1.10.0"
                dependencies {
                    dependsOn(commonTest)
                    implementation kotlin('test')
                    implementation kotlin('test-junit')
                    implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialization_version"
                    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
                    implementation "io.mockk:mockk:${mockk_version}"
                    implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
                    implementation "io.ktor:ktor-client-json-jvm:$ktor_version"
                }
            }
    However i think there's something funky going on with org.jetbrains.kotlinx:kotlinx-serialization even though supposedly it supports the JVM target - Every model i have which is annotated with
    @Serializable
    gives the following error:
    error: incompatible types: Serializable cannot be converted to Annotation @java.io.Serializable()
    r
    • 2
    • 4
  • j

    jean

    07/29/2020, 1:20 PM
    I’m targeting android, ios, and backend (jvm/ktor) in my project. I’m sharing models for all those targets but I want to share the code for the api client only between android and ios. Is there a way to tell gradle to not care about missing dependencies for
    ktor-client
    under my
    sourceSets["backendMain"].dependencies
    ?
    b
    r
    g
    • 4
    • 18
  • j

    John O'Reilly

    07/29/2020, 3:07 PM
    Has there been indication yet on whether
    native-mt
    version of kotlinx coroutines will be made available that works with Kotlin 1.4? (doesn't look at least like there's one corresponding to -rc release)
    r
    a
    +2
    • 5
    • 14
  • l

    Loboda Deni

    07/30/2020, 2:16 PM
    Hello, What do you think, if an application is currently being developed for only one platform, does it make sense to use a cross-platform architecture anyway? or will it be superfluous?
    a
    o
    +2
    • 5
    • 5
  • m

    Mgj

    07/30/2020, 3:16 PM
    I have a
    jvmTest
    sourceset that i use to run unit tests. I can run individual test-classes or individual test-methods from IntelliJ, and
    gradlew jvmTest
    also works correctly but when i try to "Run all tests..." for jvmTest i get an error: "No tests were found". What gives? Gradle:
    jvmTest {
                dependencies {
                    implementation kotlin('test')
                    implementation kotlin('test-junit')
                }
            }
    w
    a
    • 3
    • 2
  • j

    John O'Reilly

    07/30/2020, 5:55 PM
    Started testing with newly available
    1.3.8-native-mt-1.4.0-rc
    version of kotlinx coroutines. Looking good so far on Android and iOS but now on macOS I'm seeing following (when building in XCode)....has anyone else come across this?
    Undefined symbols for architecture x86_64:
      "__kernelrpc_mach_port_destroy_trap", referenced from:
          _platform_darwin__kernelrpc_mach_port_destroy_trap_wrapper850 in common(result.o)
         (maybe you meant: knifunptr_platform_darwin883__kernelrpc_mach_port_destroy_trap, _platform_darwin__kernelrpc_mach_port_destroy_trap_wrapper850 )
    👀 2
    l
    • 2
    • 5
  • s

    Skolson5903

    07/31/2020, 12:49 AM
    I have a project in Android Studio with androidApp, iosApp modules and three additional multiplatform modules. The original build.gradle.kts files were generated from the new project wizard from 1.4-M3. Lets call the three multiplatform modules mp1, mp2, and mp3 (not their real names :-)). If I make a valid unit test class names FooTest in the test directory of mp1 and attempt to debug it, Android Studio issues a gradle task "mp1:assemble", waits for that to build, then runs the debugger, The debugger then fails to start with a NoClassDefFound exception because FooTest is not compiled yet. If I then go to the gradle window, force run gradle task ":mp1:compileDebugUnitTestSources", it correctly builds the unit test, and the debugger then starts successfully. This is my first multi platform project. Do others see this behavior regarding debugging of unit tests? Whatever gradle build task is issued when debugging a unit test, seems like it should somehow tell gradle to ensure the compileDebugUnitTestSources is run. I've been working around this for a few days and still catch myself forgetting to manually run compileDebugUnitTestSources after a test source change, and then debbugging against mismatched source.
    • 1
    • 2
  • r

    rnentjes

    08/01/2020, 10:33 AM
    When I want to create a multiplatform library In 1.4-rc I must specify at least one target. I would like to be able to create a library that only has common code. And any projects that includes this library should be able to use that code in any target. Using IR as a target it seems like this should be possible as any target should be able to use ir code. Anyone know if you can do this and how to do it?
    👀 1
    j
    b
    g
    • 4
    • 7
  • j

    John O'Reilly

    08/01/2020, 11:44 AM
    Just fyi that I've released a new Kotlin Multiplatform sample (BikeShare) based on Kotlin 1.4.0-rc and related dependencies https://twitter.com/joreilly/status/1289281453457514498?s=20
    👍 14
    👏 3
    z
    r
    c
    • 4
    • 7
  • l

    louiscad

    08/01/2020, 1:49 PM
    Hello, I'm encountering this issue when trying to publish the kotlinMultiplatform publication of a library (using Kotlin 1.3.72):
    Execution failed for task ':modules:collections:allMetadataJar'.
    > Cannot expand ZIP '/home/runner/work/Splitties/Splitties/modules/collections/build/classes/kotlin/metadata/nativeMain/collections_nativeMain.klib' as it does not exist.
    Here's the Gradle scan: https://gradle.com/s/prbmyqsufsl4y And here's the GitHub Actions run: https://github.com/LouisCAD/Splitties/runs/934757382#step:4:1 What could be the root cause?
    r
    • 2
    • 3
  • a

    ahmedre

    08/01/2020, 6:01 PM
    Hi, was curious if anyone had any luck building projects with Xcode 12 beta - I have a project with Cocopods integration that builds fine under Xcode 11.x, but on Xcode 12 beta, the same project fails with:
    REPO_ROOT="$PODS_TARGET_SRCROOT"
    
                    "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :common:syncFramework                     -Pkotlin.native.cocoapods.target=$KOTLIN_TARGET                     -Pkotlin.native.cocoapods.configuration=$CONFIGURATION                     -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS"                     -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS"                     -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
    
    Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
    
    Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
    Tried manually replacing
    REPO_ROOT
    with the correct folder there but didn’t help. Don’t think it’s cocoapods related because before cocopoads, I had the manual connection way first and that was also failing with the same issue only on Xcode 12 beta.
    j
    • 2
    • 6
  • s

    Skolson5903

    08/01/2020, 11:59 PM
    Anybody got
    kotlin("native.cocoapods")
    working on windows? I have Ruby and libcurl installed, and ruby installed cocoapods just fine, but when the plugin tries to use "gem" it fails. On windows it needs to run gem.bat instead, and I have no idea if there is any way to configure this in the plugin. As a test I took out the failing plugin and put this snippet in to verify that gradle can run the stuff, and it works:
    project.exec {
        println("ruby gem version")
        commandLine("gem.cmd", "-v")
    }
    project.exec {
        println("pod version")
        commandLine("pod.bat", "--version")
    }
    This displays on the gradle console during sync, So i know both would work if I could get the plugin to use them. I tried to cheat and make shortcuts to these, but that won't work either, so I'm curious if anyone else has it. Moving to linux is not a short-term option for me🙂 . Thanks in advance for any info
    s
    • 2
    • 3
Powered by Linen
Title
s

Skolson5903

08/01/2020, 11:59 PM
Anybody got
kotlin("native.cocoapods")
working on windows? I have Ruby and libcurl installed, and ruby installed cocoapods just fine, but when the plugin tries to use "gem" it fails. On windows it needs to run gem.bat instead, and I have no idea if there is any way to configure this in the plugin. As a test I took out the failing plugin and put this snippet in to verify that gradle can run the stuff, and it works:
project.exec {
    println("ruby gem version")
    commandLine("gem.cmd", "-v")
}
project.exec {
    println("pod version")
    commandLine("pod.bat", "--version")
}
This displays on the gradle console during sync, So i know both would work if I could get the plugin to use them. I tried to cheat and make shortcuts to these, but that won't work either, so I'm curious if anyone else has it. Moving to linux is not a short-term option for me🙂 . Thanks in advance for any info
In case it's useful here's what displays during sync from the snippets above:
ruby gem version
3.1.2
pod version
1.9.3
s

Sam

08/02/2020, 3:27 AM
Mac and iOS development is only available on macOs platforms.
☝️ 1
s

Skolson5903

08/02/2020, 6:10 PM
My understanding was that basics like these utilities wok if ruby and libcurl are installeds, and the pod installed with gem, which all worked. See this link Using cocoapods on windows
View count: 10