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

    pajatopmr

    03/28/2019, 12:45 PM
    This may border on brain-dead-stupid, nevertheless. First, is it even possible to build a common module, deploy it and then use that module as a dependency for multiple independent platform modules, each deployed separately? Second, is this a really, really bad idea? It appeals to me because, assuming it can be made to work without too much pain, it offers multiple small independent modules, each likely to be easy to grok, fast to build, easy to test, and independent of platform quirks (like naming rules for test functions).
    a
    l
    +1
    21 replies · 4 participants
  • e

    Ellen Shapiro

    03/28/2019, 1:14 PM
    My project has recently decided it hates Instant Run for its android component. It seemed to be working fine with coroutines + ktor + serialization, but when I added SQLDelight I had to make some changes (including upgrading to Gradle 5.1.1) which seem to have broken the crap out of instant run. Has anyone else run into this issue? Any thoughts on things which might be causing this?
    s
    d
    +1
    5 replies · 4 participants
  • k

    Kris Wong

    03/28/2019, 7:22 PM
    very strange... I have a fairly complicated regex in an MPP library project that works fine on iOS and in 'jvmTest', but blows up on Android
    a
    17 replies · 2 participants
  • k

    Kris Wong

    03/29/2019, 1:58 PM
    I have an mpp project as a submodule of an Android Studio project. I can't seem to come up with any run configuration that will execute the tests in 'jvmTest' with this setup. The tests work if I open the mpp project itself in intellij. Has anyone seen this?
    1 reply · 1 participant
  • k

    Kris Wong

    03/29/2019, 2:09 PM
    I also notice that to open the project within intellij requires a plugin version, and to include it as a submodule requires there be no version
    2 replies · 1 participant
  • g

    GarouDan

    03/29/2019, 4:49 PM
    Hi buddies, I’m working on a project that uses a
    js
    ,
    jvm
    and
    native
    targets. The strange thing is I cannot make the js tests fail, it looks it is being ignored. Does someone had a problem like this or knows an workaround? This is very strange.
    i
    k
    +4
    18 replies · 7 participants
  • g

    GarouDan

    03/30/2019, 10:50 AM
    Hey guys, let me ask you something I would like to put a code like this one
    fun getPackage(class_: KClass<*>): String? = class_.qualifiedName?.replace(".${class_.simpleName}", "")
    in my
    common
    module of a
    multiplatform
    project. The problem is the
    .qualifiedName
    part doesn’t work in JavaScript and because of that I’m receiving the following error:
    Unsupported [This reflection API is not supported yet in JavaScript]
    It would be very nice to see JavaScript supporting the full reflection API, but, either way, the problem is a bit different. My code is not compiling in the JavaScript module because of that. But all of my targets other than the js could benefit from that, so, how could I avoid this error in order to make this code work for native and jvm targets and let js without that? Where the code could live inside the
    common
    module?
    i
    d
    6 replies · 3 participants
  • p

    pardom

    03/30/2019, 8:38 PM
    Has anyone tried mpp in Bazel yet?
    l
    2 replies · 2 participants
  • p

    pajatopmr

    03/31/2019, 12:31 PM
    So I am trying to add the Android platform to a multiplatform library using IntelliJ. Is there an example that shows the Gradle build script using Kotlin that someone would care to recommend? Gradle version is 5+ fwiw.
    t
    r
    +1
    10 replies · 4 participants
  • d

    Damiano Giusti

    04/01/2019, 7:50 AM
    Hello, I added the kotlix.test library to my multiplatform project using the
    kotlin-multiplatform
    plugin. The build passes, however the annotations and the test methods aren’t visible from test classes. I’m using the groovy build.gradle
    commonTest {
        dependencies {
            implementation "org.jetbrains.kotlin:kotlin-test-common"
            implementation "org.jetbrains.kotlin:kotlin-test-annotations-common"
            implementation "io.mockk:mockk-common:1.9"
        }
    }
    I started by using
    testImplementation
    but I received such error
    Could not find method testIplementation() for arguments [org.jetbrains.kotlin:kotlin-test-common] on object of type org.jetbrains.kotlin.gradle.plugin.mpp.DefaultKotlinDependencyHandler
    , and then moved to
    implementation
    . Could someone give me a clue? Thanks
    t
    6 replies · 2 participants
  • p

    pandawarrior

    04/01/2019, 10:12 AM
    I have caught
    kotlin.TypeCastException
    while using coroutine’s
    async/await
    in
    common
    when running on iOS. But it works well on Android. Any advice to go about this?
    s
    5 replies · 2 participants
  • j

    JoakimForslund

    04/01/2019, 12:20 PM
    Is there a way in kotlin multiplatform to include a imagefile in the resources that later will be loadable with i.e:
    image = UIImage.imageNamed("image/$file.png");
    from iOS target? My current idea is using base64 and storing it common code but it would be pretty sweet if the resources-folder could be used in my static library
    ➕ 1
    r
    g
    6 replies · 3 participants
  • m

    manijshrestha

    04/02/2019, 4:40 PM
    Quick post about Kotlin multiplatform usage at Target Registry app: https://tech.target.com/2019/04/02/gift-registry-kotlin-multiplatform.html
    🎉 8
    k
    j
    2 replies · 3 participants
  • n

    Nikolai

    04/03/2019, 4:54 AM
    Hi, everyone. In multiplatform project is where any way to build app.framework for iOS part without running XCode? Just build this framework from IDEA and use it in desired way.
    o
    3 replies · 2 participants
  • m

    Marc Knaup

    04/03/2019, 10:35 AM
    Is there any development build of IntelliJ IDEA or the Kotlin Plugin where multiplatform composite builds work properly? It's so frustrating 😭
    ➕ 1
    r
    h
    10 replies · 3 participants
  • o

    o.semen

    04/03/2019, 3:07 PM
    what type of framework for iOS is generated ? static or dynamic ?
    b
    o
    5 replies · 3 participants
  • w

    waqas

    04/03/2019, 3:14 PM
    Hi I have
    kotlinOptions.moduleKind = "umd"
    in my jsMain block. Whenever I build it I get in
    sharemodule/build/libs/sharedcode-js.jar
    and sharedcode.js file only in
    /build/classes/kotlin/js/main/sharedcode.js
    For now I just want to test shared code in a separate very simple Kotlin-JS project. Which file I am suppose to include in new project to use sharedcode built for JS?
    d
    2 replies · 2 participants
  • h

    Hauke Radtki

    04/04/2019, 8:00 AM
    I have a MPP module with JVM, Android and iOS targets. I want to have another JVM module depend on the MPP module. This currently fails because the MPP module has to apply the Android plugin and the jvm module complains about that it can not depend on a project that applies the android plugin. My current workaround is to publish the MPP to mavenLocal and then depend on that. But this looks hackish to me and is error prone (not to forget to publish to mavenLocal ...)
    s
    h
    18 replies · 3 participants
  • r

    Ryan Perkins

    04/04/2019, 3:08 PM
    https://blog.jetbrains.com/kotlin/2019/04/kotlinnative-support-for-appcode-2019-1/
    🎉 10
    g
    1 reply · 2 participants
  • p

    Patrick Jackson

    04/04/2019, 6:00 PM
    has anyone tried kotlinx.coroutines.delay() on iOS? Seems to just die on me. maybe something to do with multithread coroutine support on iOS?
    j
    b
    8 replies · 3 participants
  • s

    Shan

    04/04/2019, 8:48 PM
    Hey all. Is there a way to publish the artifacts generated from commonMain to Maven? And if so, should I be actually uploading the artifacts from commonMain to Maven? I might be thinking about this incorrectly, but if, for example, someone were to make a separate multiplatform project and wanted to call methods in their common code from my multiplatform project's common code. Is there a different way they should be doing this other than to have a dependency on my project's common code?
    p
    s
    9 replies · 3 participants
  • p

    Patrick Jackson

    04/05/2019, 2:02 PM
    Is it currently possible to consume a cocoapod in a Kotlin MPP shared module? I see this plugin(https://github.com/JetBrains/kotlin-native/blob/master/COCOAPODS.md). Is that the best option currently? Use case being creating a library that uses a cocoapod dependency for iOS implementation.
    🌟 1
    👍 1
    k
    s
    +1
    16 replies · 4 participants
  • j

    Jan Stoltman

    04/05/2019, 3:54 PM
    Hello guys, friday afternoon question. I'm building and iOS app with kotlin multiplatform, coroutines, ktor and kotlinx.serialization and I'm having a problem with serializing huge json files (like mbs huge). As I'm using ktor I have to use coroutines to handle the
    suspend
    functions, this means that I'm restricted to using the UI dispatcher (afaik there is no IO dispatcher for mpp projects?). Everything worked just fine with small files, but when I try to parse this huge json my app freezes. It happens with any CPU-intense operation really. I've figured out that I could use
    concurrent.Worker
    for CPU-intense operations, as it doesn't block my UI. But I just cannot figure out how to join coroutines and workers, things just explode when I try to launch either one inside the other. Is there a way to get a json file from ktor, inside a coroutine, and then process it with workers? Do you guys have any recommendations? Any ideas for a direction which I could take?
    o
    1 reply · 2 participants
  • g

    GarouDan

    04/06/2019, 1:41 AM
    Hi folks, I’m receiving an error like this one when trying to run a
    publishToMavenLocal
    task of mine:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':myLibrary:generateMetadataFileForMyLibraryIosX64Publication'.
    ...
    Caused by: java.lang.ClassCastException: org.jetbrains.kotlin.gradle.plugin.mpp.HierarchyAttributeContainer cannot be cast to org.gradle.api.internal.attributes.AttributeContainerInternal
    Would you have any clue as to what might cause this? I’m using a configuration like:
    compilations["main"].outputKinds("framework")
    but even if I disable it I receive the same error
    l
    3 replies · 2 participants
  • s

    Shan

    04/07/2019, 4:54 PM
    Has anyone encountered any issues with using a custom test framework with kotlin mp? I'm using the Spek framework and it cannot seem to find my tests to run them, I'm assuming because of the project structure as the same buildscript works in my other, non-mp projects. Is there a way to point a custom test framework to the right sourceSet (like
    jvmTest
    )?
    c
    1 reply · 2 participants
  • e

    egorand

    04/07/2019, 10:33 PM
    Trying to upgrade Okio from Gradle 5.1 to 5.3.1. There’s a
    :samples
    module containing Java code that uses types declared in the
    common
    source set of the main module. After the upgrade
    :samples:compileJava
    started failing with a lot of
    cannot find symbol
    errors, pointing to those types. The dependency on the main module is declared as
    implementation project(path: ':okio', configuration: 'runtimeElements')
    . Have there been any changes that could’ve broken our setup?
    a
    3 replies · 2 participants
  • g

    gumil

    04/08/2019, 11:18 AM
    has anyone encountered
    cannot access class <class-name>. check your module or classpath for missing or conflicting dependencies
    in Android Studio, but when running, it’s fine and tests are also running?
    a
    m
    +1
    7 replies · 4 participants
  • g

    GarouDan

    04/09/2019, 2:14 AM
    Hi guys, a simple question if we have a target
    android
    and the source sets
    androidMain
    and
    androidTest
    , can we say that
    androidTest
    will see all
    androidMain
    definitions and dependencies? Or is it not true?
    s
    r
    3 replies · 3 participants
  • l

    Lawik

    04/09/2019, 7:24 AM
    Does anyone have experience with setting up gretty in a multiplatform project? (or the war plugin)
    t
    15 replies · 2 participants
  • i

    ivan.savytskyi

    04/09/2019, 3:28 PM
    hey folks is this configuration works for you: https://github.com/JetBrains/kotlin-native/blob/master/FAQ.md#q-how-do-i-rename-the-ios-framework-default-name-is-project-nameframework? I can’t make it to generate custom named framework, it’s keep generating
    main.framework
    k
    i
    5 replies · 3 participants
Powered by Linen
Title
i

ivan.savytskyi

04/09/2019, 3:28 PM
hey folks is this configuration works for you: https://github.com/JetBrains/kotlin-native/blob/master/FAQ.md#q-how-do-i-rename-the-ios-framework-default-name-is-project-nameframework? I can’t make it to generate custom named framework, it’s keep generating
main.framework
k

Kris Wong

04/09/2019, 3:32 PM
iosX64("ios") {
        compilations.main {
            outputKinds "FRAMEWORK"
        }
        binaries {
            framework("$ios_framework_name")
        }
    }
👍 1
:tnx: 1
i

ilya.matveev

04/10/2019, 9:01 AM
The
compilation.outputKinds
DSL is deprecated in 1.3.30 and replaced by the binaries block. So actually the example above creates two frameworks: the first one using the old
compilation.outputKinds
DSL and the second one using the binaries block. You can just remove
outputKinds
and declare the framework using the binaries block only:
iosX64("ios") {
    binaries {
        framework("$ios_framework_name")
    }
}
🍻 1
:tnx: 1
BTW access to frameworks declared using the binaries block differs from the old one. See https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#building-final-native-binaries. You also can take a look at this diff: https://github.com/JetBrains/kotlin-mpp-example/compare/1f8d3a535291c4618fed2da62b8736688e1ae846..44034c1179e6890d3e2de85c4d1828196069850a. It shows migrating from the old DSL to the new one except disabling bitcode. It was just a workaround and can be omitted now.
k

Kris Wong

04/10/2019, 1:31 PM
i had noticed the 2 frameworks, but didn't care enough to look into it
thanks!
View count: 1