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

    Nikolai

    03/17/2019, 3:22 AM
    Hello, everyone I am working with multiplatform project. For a long time I worked on Android part. But today I started to work with iOS part, I added :
    dependencies {
                    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
                }
    to iosMain dependences because my project uses coroutines in common part. After that I changed graddlew to update graddle version. Then I run buildDependences task to build all dependences. Success, after that I tried to run XCode project but got error:
    * What went wrong:
    Could not determine the dependencies of task ':app:copyFramework'.
    > Task with path 'linkDebugFrameworkIos' not found in project ':app'.
    I went to IDEA and found that 'copyFramework' task depends on 'linkDebugFrameworkIos', but I didn't find it in graddle tasks list.
    task copyFramework {
        def buildType = project.findProperty("kotlin.build.type") ?: "DEBUG"
        def target = project.findProperty("kotlin.target") ?: "ios"
        dependsOn "link${buildType.toLowerCase().capitalize()}Framework${target.capitalize()}"
    
        doLast {
            def srcFile = kotlin.targets."$target".compilations.main.getBinary("FRAMEWORK", buildType)
            def targetDir = getProperty("configuration.build.dir")
            copy {
                from srcFile.parent
                into targetDir
                include 'app.framework/**'
                include 'app.framework.dSYM'
            }
        }
    }
    I assume that when I upgraded graddle and changed graddlew it somehow removed this task. How can I fix it?
    e
    s
    • 3
    • 5
  • g

    galex

    03/18/2019, 10:17 AM
    Hello, in an MP project for the iOS target we do not need to depend on a kotlin stdlib like we do for all the other sourcesets, what’s the reason for this?
    r
    r
    s
    • 4
    • 6
  • m

    Matouš Skála

    03/18/2019, 2:30 PM
    Is there a way to specify the framework name generated by iOS target? The example project generates
    main.framework
    and I haven't found a way to change this. https://github.com/JetBrains/kotlin-examples/blob/master/tutorials/mpp-iOS-Android/SharedCode/build.gradle
    o
    j
    s
    • 4
    • 7
  • g

    gumil

    03/18/2019, 4:08 PM
    Hi, is it safe to assume that the metadata.jar that is produced by the multiplatform plugin can be used as the compiled common sources?
    d
    r
    s
    • 4
    • 5
  • d

    Dico

    03/18/2019, 8:43 PM
    Are there any library options for a simple single threaded observable/observer framework in kotlin multiplatform?
    👍 1
    a
    • 2
    • 11
  • g

    galex

    03/19/2019, 6:52 AM
    Could we have in the future a target for Dart? Thinking of Flutter for instance
    🇳🇴 3
    a
    s
    +3
    • 6
    • 7
  • l

    Liang Song

    03/19/2019, 9:37 AM
    Hi, is there a way the multiplatform project uses Int instead of Int32, I used it on Swift that Int types are Int32 in Swift. That causes some minor headaches.
    s
    • 2
    • 2
  • c

    czuckie

    03/19/2019, 1:10 PM
    hello fellow kotlin-folk: I created a kotlin native project in clion which seems to be using the multiplatform project plugin (using kotlinscript gradle), how would I go about adding a common module after the fact of creating a project without a common module?
    e
    • 2
    • 2
  • s

    stanislav

    03/19/2019, 2:30 PM
    Hi, I'm getting crash @ iOS @ Kotlin_Array_get
    s
    • 2
    • 14
  • r

    ribesg

    03/20/2019, 10:38 AM
    Hi, we have a dependency problem with our iOS target
    g
    d
    s
    • 4
    • 25
  • s

    stanislav

    03/20/2019, 2:30 PM
    Hi. I'm getting kotlin.TypeCastException, but only on iOS. How can I debug it?
    e
    • 2
    • 8
  • b

    basher

    03/20/2019, 5:09 PM
    has anyone run into
    Duplicate JVM class name
    issues working with `expect`/`actual`?
    p
    r
    +2
    • 5
    • 8
  • n

    Nicolas

    03/20/2019, 7:08 PM
    Hi! I'm unable to
    import android.content.*
    in my mpp project. What do I need to add to my
    build.gradle
    to make it work? thanks in advance.
    l
    • 2
    • 1
  • u

    uli

    03/21/2019, 8:39 AM
    Hi, running the main JVM method of my mpp project in intelij works exactly once. If I hit run again, I get a class not found exception for my main class. Cleaning the build resolves the problem and I can run the project once again before the class not found exception comes back. Is this a known issue? Are there any workarounds?
    g
    d
    • 3
    • 2
  • s

    stanislav

    03/21/2019, 10:46 AM
    Hi. I'm getting
    mutation attempt of frozen io.ktor.client.request.HttpRequestPipeline@8275c448
    on iOS.
    r
    o
    • 3
    • 5
  • r

    raulraja

    03/21/2019, 12:56 PM
    Anyone succeeding at meta-programming in MPP projects with kapt or other ways to codegen for all platforms? Kapt is JVM only and we rely on Arrow on annotation processing to generate code at the moment. Not being able to use kapt in MPP projects is currently not allowing to publish for JS and native. Any advice or recommendations are much appreciated. Thanks!
    ❤️ 2
    p
    g
    +4
    • 7
    • 37
  • i

    ivan.savytskyi

    03/21/2019, 4:18 PM
    hey folks I’m a little confused regarding the versioning of KN. So if I use MPP Gradle plugin with Kotlin version
    1.3.21
    what version of KN it uses? Running the build with info I see
    kotlin-native-macos-1.1.2
    but I can’t figure out where is this configuration comes from? And how for instance to configure MPP plugin to use different KN version (I saw from change logs that new `1.2.0`one is available)
    o
    • 2
    • 1
  • g

    galex

    03/22/2019, 7:10 AM
    Hi, can I depend on kotlin-js-wrappers to create React components in a multiplatform project? When I added the dependency to my JS/Node target I couldn’t import RComponent for instance
    s
    • 2
    • 5
  • l

    Liang Song

    03/22/2019, 9:34 PM
    Hi, I have a mpp which uses kotlin 1.3.30-eap-45 and coroutine 1.1.1, I got these two warnings when run compileKotlinIos
    The compiler versions don't match either. Expected '[1.2]', found '1.1.1-release-6082'
    ,
    kotlinx-coroutines-core-native.klib. The abi versions don't match. Expected '[8]', found '5'
    build failed after the two warnings
    Could not find kotlinx-coroutines-core-native.klib
    d
    • 2
    • 12
  • j

    John Lutteringer

    03/22/2019, 10:55 PM
    Hi, I have a multi-module multi-platform project and am trying to get the gradle configuration to work. Right now I'm just trying to convert 1 sub-module over to a multi-platform module. Specifically I am using 1.3 DSL with source sets. I have moved my existing code out of src/main/kotlin and into src/jvmMain and attempted to configure a jvmMain source set to compile those files. I have tried adding the source set configuration to both the root project and the module with no success. No errors, just the files don't get compiled. Its like nothing is looking at the src/jvmMain directory and is still looking at src/main/kotlin.
    g
    • 2
    • 4
  • b

    basher

    03/24/2019, 2:35 AM
    I'm trying to call a function from the windows platform libraries:
    BCryptGenRandom
    . At link time, I get
    undefined reference to 'BCryptGenRandom'
    . Here are the linker settings I have for my mingw test target:
    targetFromPreset(presets.mingwX64, 'mingw') {
        compilations.test.linkerOpts '-Wl,--subsystem,windows,-L"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.17763.0\\um\\x64\\bcrypt.lib"'
    }
    I think I may have overdone it with the full path to bcrypt.lib there, but I'm trying everything. Any advice here would be appreciated! First time attempting to get my K/N code working for mingw. Thanks!
    m
    o
    • 3
    • 9
  • j

    Jake

    03/24/2019, 6:34 PM
    Hey all I’m starting to create multiplatform libraries in Kotlin and I’m having trouble with integrating KTOR into the project. I’ve found several examples of multi gradle project projects that do it, but I can’t figure it out in my single gradle project. Obviously my gradle game isn’t strong. Can anyone point me in the right direction?
    g
    • 2
    • 4
  • j

    John Lutteringer

    03/25/2019, 6:21 AM
    When creating a multiplatform project, I have .java files in the jvmMain and jvmTest source sets. However, when building the project these files seem to be ignored and only .kt files get compiled. Is there something special I need to do to get the multiplatform configuration to also compile java files in the jvm* source sets?
    r
    g
    • 3
    • 2
  • g

    GarouDan

    03/25/2019, 11:39 AM
    Hi guys, I would like to get the package name of a class using the kotlin common library. Does someone know if we can do this? For example, when using jvm we can do something like:
    java.util.Date().javaClass.
    package
    .name
    but can we do something similar to get the same result with
    stdlib-common
    ?
    • 1
    • 1
  • t

    thana

    03/25/2019, 11:51 AM
    e.g. javascript doesnt have packages hence that's not possible for a jsTarget so there is no common way
    d
    • 2
    • 1
  • v

    verachadw

    03/25/2019, 2:17 PM
    Hi all. I found the problem on iOS 32 bit devices with our Multiplatform application. Everything work fine when we testing in debug build, but It always crash when launching with Testflight version. Have anyone encounter this kind of problem before?
    s
    a
    • 3
    • 8
  • g

    galex

    03/25/2019, 7:37 PM
    Hello, does anyone know how I can use js externals in the js target of a multiplatform project? I would like to build not only a JS library but a React library, not only a JS lib to be used in a React app (to be able to build relevant React UI Components as we can build views the same way for Android libs and for iOS frameworks) ?
    • 1
    • 1
  • k

    Kris Wong

    03/27/2019, 3:31 PM
    I notice that when I update the headers in an obj-c framework used through cinterop, I have to delete the build directory before it will regenerate the bindings (using intellij)
    l
    • 2
    • 3
  • s

    Sam

    03/27/2019, 4:21 PM
    I'm getting an error that a class has been redeclared while running unit tests. If I do a
    clean
    it is fine until I make a change and rerun my tests. When I run with
    --info
    it appears that one of the files is being detected as modified twice.
    > Task :myappcore:compileTestKotlinJvm FAILED
    Task ':myappcore:compileTestKotlinJvm' is not up-to-date because:
      Input property 'commonSourceSet$kotlin_gradle_plugin' file /source/path/app/myappcore/src/commonTest/kotlin/net/myapp/core/dice/RollStreamTests.kt has changed.
      Input property 'source' file /source/path/app/myappcore/src/commonTest/kotlin/net/myapp/core/dice/RollStreamTests.kt has changed.
    Using Kotlin/JVM incremental compilation
    Options for KOTLIN DAEMON: IncrementalCompilationOptions(
    	super=CompilationOptions(compilerMode=INCREMENTAL_COMPILER, 
    	targetPlatform=JVM, 
    	reportCategories=[0], 
    	reportSeverity=2, 
    	requestedCompilationResults=[0]), 
    	areFileChangesKnown=true, 
    	modifiedFiles=[
    			/source/path/app/myappcore/src/commonTest/kotlin/net/myapp/core/dice/RollStreamTests.kt, 
    			/source/path/app/myappcore/src/commonTest/kotlin/net/myapp/core/dice/RollStreamTests.kt], 
    	deletedFiles=[], 
    	workingDir=/source/path/app/myappcore/build/kotlin/compileTestKotlinJvm, 
    	multiModuleICSettings=MultiModuleICSettings(buildHistoryFile=/source/path/app/myappcore/build/kotlin/compileTestKotlinJvm/build-history.bin, useModuleDetection=false), 
    	usePreciseJavaTracking=trueoutputFiles=[
    			/source/path/app/myappcore/build/classes/kotlin/jvm/test, 
    			/source/path/app/myappcore/build/kotlin/compileTestKotlinJvm])
    e: /source/path/app/myappCore/src/commonTest/kotlin/net/myapp/core/dice/RollStreamTests.kt: (5, 7): Redeclaration: RollStreamTests
    e: /source/path/app/myappcore/src/commonTest/kotlin/net/myapp/core/dice/RollStreamTests.kt: (5, 7): Redeclaration: RollStreamTests
    :myappcore:compileTestKotlinJvm (Thread[Task worker for ':',5,main]) completed. Took 0.44 secs.
    This is using eap 45 if that matters. The same issue happened under eap 11 and the latest stable as well .
    • 1
    • 1
  • s

    Steven

    03/27/2019, 5:32 PM
    Is anyone able to create both arm64 and x64 for iOS using cocoapods? I don't know what i'm doing wrong but i can't seem to provide a framework to cocoapods with both architectures...
    s
    j
    l
    • 4
    • 6
Powered by Linen
Title
s

Steven

03/27/2019, 5:32 PM
Is anyone able to create both arm64 and x64 for iOS using cocoapods? I don't know what i'm doing wrong but i can't seem to provide a framework to cocoapods with both architectures...
s

Sam

03/27/2019, 5:38 PM
You need to use the lipo tool to combine them. The catch is that when archiving the app for upload the x64 portion of the framework needs to be removed with lipo again. Otherwise the app will be rejected.
s

Steven

03/27/2019, 5:41 PM
thank you for the insight! Do you know where i can find a tutorial for using the lipo tool in a kotlin mpp environment?
j

Jonas Bark

03/27/2019, 5:42 PM
https://github.com/AlecStrong/kotlin-native-cocoapods makes this step super simple
👍 1
s

Steven

03/27/2019, 5:52 PM
thank you very much! 🙂
I can't seem to access classes in my kotlin lib when using this gradle plugin, but it does generate the right architectures though 🤔
l

Liang Song

04/03/2019, 10:49 PM
I have the same issue for accessing classes, check this issue https://github.com/AlecStrong/kotlin-native-cocoapods/issues/14
View count: 4