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
kotlin-native
  • t

    tevjef

    05/10/2019, 1:39 AM
    Does anyone else have trouble linking the static framework cocoapod with an existing project that uses dynamic frameworks on iOS?
    o
    • 2
    • 1
  • p

    Paul Idstein

    05/10/2019, 8:29 AM
    Why is it not possible to declare a typealias to CPointer<T> for expect declaration? e.g.
    expect class Image
    
    actual typealias Image = platform.CoreVideo.CVPixelBufferRef // iOS -  'declaration is incompatible because number of type parameters is different'
    d
    s
    r
    • 4
    • 6
  • t

    Thomas

    05/10/2019, 6:01 PM
    I’m unable to build an archive in Xcode so I can publish a build to TestFlight. I have no issues doing a normal build to a device/simulator but the Archive option fails with the following error:
    > Task :common:generateDefCrashlytics
    
    > Task :common:cinteropCrashlyticsIOS
    Exception in thread "main" org.jetbrains.kotlin.konan.KonanExternalToolFailure: The /Users/thomas/.konan/dependencies/clang-llvm-6.0.1-darwin-macos/bin/clang command returned non-zero exit code: 1.
    	at org.jetbrains.kotlin.konan.exec.Command.handleExitCode(ExecuteCommand.kt:105)
    	at org.jetbrains.kotlin.konan.exec.Command.getResult(ExecuteCommand.kt:94)
    	at org.jetbrains.kotlin.konan.exec.Command.getOutputLines(ExecuteCommand.kt:73)
    	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.runCmd(main.kt:66)
    	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:281)
    	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:38)
    	at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:67)
    	at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:18)
    
    > Task :common:cinteropCrashlyticsIOS FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':common:cinteropCrashlyticsIOS'.
    > Process 'command '/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at <https://help.gradle.org>
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See <https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings>
    
    BUILD FAILED in 5s
    2 actionable tasks: 2 executed
    Command PhaseScriptExecution failed with a nonzero exit code
    I don’t know what I need to look at as the exception doesn’t really show the cause of the issue. In case it might be related; I am using the Cocoapods plugin and have a Crashlytics pod in the Gradle file. Anyone have any ideas how to proceed?
    s
    i
    • 3
    • 14
  • t

    tapchicoma

    05/10/2019, 8:05 PM
    Non-final Kotlin classes inheriting Swift/Objective-C types aren't supported yet, so it is not possible to declare a complex class hierarchy inheriting Swift/Objective-C types.
    Any plans to remove this restriction? At least for the classes in the same module?
    s
    • 2
    • 2
  • r

    RemusRD

    05/10/2019, 11:03 PM
    Are there any httpclients that I can use to develop in MacOs and compile to linux?
    d
    n
    • 3
    • 8
  • j

    Jake

    05/11/2019, 7:56 PM
    Anyone have any luck using carthage’s
    binary
    build option to retrieve a Kotlin Native Framework?
    • 1
    • 1
  • d

    David Stolarsky

    05/12/2019, 9:30 AM
    iOS Swift interop question:
    Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared kotlin.collections.HashMap@8015aa08 from other thread
    How do I go about avoiding this? Can I simply make the HashMap in question shared? Immutable? Freeze it? Throw a bunch of
    DispatchQueue.main.async {  }
    wrappers everywhere? The stack trace goes from Kotlin to Swift and back to Kotlin at least once, likely more than once. The thread that is crashing is
    com.google.firebase.auth.globalWorkQueue
    d
    k
    p
    • 4
    • 9
  • l

    landoulsi

    05/13/2019, 8:51 AM
    Hello, I am not able to configure coroutines in kotlin native only adding the corooutines library I can compile the project but after just putting simple :
    GlobalScope.launch {
        }
    it fails to build the project :
    e: /MultiplatformApp/SharedCode/src/commonMain/kotlin/common.kt: (3, 16): Unresolved reference: coroutines
    e: /MultiplatformApp/SharedCode/src/commonMain/kotlin/common.kt: (4, 16): Unresolved reference: coroutines
    e: /MultiplatformApp/SharedCode/src/commonMain/kotlin/common.kt: (9, 5): Unresolved reference: GlobalScope
    Simple project is available at github: https://github.com/landoulsi/MultiplatformApp Please help
    s
    • 2
    • 3
  • l

    landoulsi

    05/13/2019, 9:51 AM
    j
    • 2
    • 4
  • l

    landoulsi

    05/13/2019, 10:13 AM
    Any help on the above please ^^
    s
    • 2
    • 4
  • s

    serebit

    05/13/2019, 5:51 PM
    The Kotlin docs state that only Kotlin/JVM supports tailrec functions. Is this still accurate? Kotlin/JS seems to support them, and I can’t test native at the moment. (source: https://kotlinlang.org/docs/reference/functions.html#tail-recursive-functions)
    o
    • 2
    • 1
  • e

    elect

    05/13/2019, 5:57 PM
    has anyone here done anything with Kotlin and Metal?
    🤘 2
    d
    • 2
    • 6
  • p

    Paul Idstein

    05/15/2019, 8:44 AM
    Given I have some code in swift using Kotlin exported definitions. It is possible to derive from the ObjClass object the KClass?
    data class KotlinData(val a: String)
    
    fun <O> createInstance(val classifier: KClass<O>): O
    In Swift
    createInstance(KotlinData.self) <-- Fails as this is not KClass
    s
    o
    • 3
    • 7
  • u

    4ntoine

    05/15/2019, 8:53 PM
    Hey, guys. I’ve tried to compile Kotlin code with Kotlin/Nativ for android x86 (emulator and small percentage of devices) and found no such target. This task seems to be related and closed: https://github.com/JetBrains/kotlin-native/issues/939. Anything on this?
    r
    • 2
    • 2
  • c

    Casper Lans

    05/15/2019, 9:04 PM
    Kotlin/Native supports Android as target platform. What is the difference with using the kotlin-jvm compiler to target Android?
    n
    r
    • 3
    • 4
  • u

    4ntoine

    05/15/2019, 9:07 PM
    @Casper Lans it’s because not all Android apps are JVM apps mostly: eg. Chromium. BTW i can see
    arm32
    and
    arm64
    are supported. The questions is about
    android x86
    ❓ 1
    c
    • 2
    • 2
  • k

    kpgalligan

    05/15/2019, 11:15 PM
    Windows developer friends! I have a (probably) basic question. If I wanted to link to sqlite3, and I were developing in a pretty fresh windows instance, and had msys2 installed, what would I do? We're adding -lsqlite3 as a linker arg and LD can find it, but I'm told that should work. Thoughts? Thanks in advance
    m
    • 2
    • 6
  • u

    4ntoine

    05/16/2019, 5:34 AM
    Hey, guys. I need to be able to access some Java API (classes from
    java.security
    to be more detailed) from Kotlin code that is compiled with Kotlin/Native into binary (shared library used on android). Any suggestions on how i can achieve it? In regular java code i had to write JNI glue code for this i guess, wondering if i can achieve it more in more elegant way with Kotlin
    g
    t
    s
    • 4
    • 56
  • f

    felislynx

    05/16/2019, 9:56 AM
    Hi, i'm wondering if Kotlin Native will provide ui toolkit that could be used in Linux/Windows/OSX environment. Android and iOS have good ui frameworks and it is easy to make ui. I know, that there is JavaFX/TornadoFX but to be honest, it still looks like it was taken from 1996 and layout managers are poor compared to ConstraintLayout.
    g
    o
    • 3
    • 13
  • a

    antrax

    05/16/2019, 11:15 AM
    Hi, is there any good example of transferring ownership in K/N? We're struggling to pass object hierarchy created in one thread to another one. It will be mutated there so just .freeze() doesn't work.
    r
    k
    +3
    • 6
    • 41
  • k

    kpgalligan

    05/16/2019, 4:33 PM
    On the question of debugging, dependencies, etc (a thread -->)
    o
    v
    • 3
    • 8
  • l

    louiscad

    05/18/2019, 8:03 PM
    It'd be nice to have Kotlin/Native samples in their own repository so they're unbundled from everything else making Kotlin/Native run that is frequently updated, don't you think? When I read the instructions in top-level README that I assume are needed to run the samples, I see this:
    The build can take about an hour on a Macbook Pro.
    and I'm now thinking: "So… to run these simple samples, I need to wait for long… what if I have a MacBook Air? How many hours to run these samples??" Maybe there's another way, but for now, I'm close to dropping that new Kotlin/Native understanding attempt because of that time barrier.
    ➕ 2
    j
    • 2
    • 3
  • l

    louiscad

    05/18/2019, 11:35 PM
    I finally could build most of the samples (and even succeeded in making coroutines run on macOS on main dispatch queue), but WOW, that was so much errors to dodge. Worth a full post. I wrote a draft as I went through them, I'll share it later.
    💯 12
    s
    k
    j
    • 4
    • 10
  • b

    Brian Stanek

    05/20/2019, 2:48 PM
    Is implementation by delegation not supported on K/N? In a multiplatform project,
    class ListLike(val list: List<String>) {}
    works great, but
    class ListLike(val list: List<String>) : List<String> by list {}
    does not generate an entry in the iOS framework. However, the javascript modules does create all the delegating methods. Is this a known limitation?
    s
    • 2
    • 7
  • s

    Sam

    05/20/2019, 8:38 PM
    Does
    1.3.40-EAP1
    include the better objc interop PR that was recently merged?
    o
    • 2
    • 2
  • d

    David Stolarsky

    05/21/2019, 8:47 AM
    I get
    EXC_BAD_ACCESS
    in an Objective-C++ object deallocation stack in thread
    Queue: com.google.firebase.firestore (serial)
    where it is, er, "releasing its reference" to a Swift closure I passed it. Inside the Swift closure is a reference* to a Kotlin lambda that was passed into my Swift code from my Kotlin code. when I refactor the code to not pass the Kotlin lambda into Swift, the crash (seems to**) go away. Am I missing something obvious? Should I
    .freeze()
    that lambda? *The Kotlin lambda does not need to be called for the crash to occur. **The crash is known to both occur and not occur without any code changes, but I seem to have found a configuration where it reliably happened 100% of the time, then refactoring out the lambda made it go away.. could theoretically still be a red herring.
    s
    • 2
    • 5
  • e

    elect

    05/21/2019, 10:54 AM
    -.php
    r
    o
    • 3
    • 6
  • d

    David Stolarsky

    05/22/2019, 6:11 AM
    when I used
    .freeze()
    , is there a way to mark a method or lambda as non mutating, so i can call it from Swift without creating a
    kotlin.native.concurrent.InvalidMutabilityException
    ?
    o
    s
    • 3
    • 23
  • r

    ribesg

    05/22/2019, 1:11 PM
    Any mocking library for kotlin native tests?
    🇳🇴 3
    b
    j
    +4
    • 7
    • 32
  • o

    oleksandr.stepanov

    05/23/2019, 9:20 AM
    Hello mates 👋 Has anybody investigated the topic of CI for mobile app project with Kotlin/Native used for code sharing between iOS and Android? I mean not custom solution with own managed server, but services like CircleCI, MS AppCenter etc. The main caveat I see: iOS project must be built on mac machine, while Android could on mac or Linux (I do not consider Windows atm). I didn’t find any CI service which supports Kotlin/Native out of the box.
    s
    y
    +2
    • 5
    • 10
Powered by Linen
Title
o

oleksandr.stepanov

05/23/2019, 9:20 AM
Hello mates 👋 Has anybody investigated the topic of CI for mobile app project with Kotlin/Native used for code sharing between iOS and Android? I mean not custom solution with own managed server, but services like CircleCI, MS AppCenter etc. The main caveat I see: iOS project must be built on mac machine, while Android could on mac or Linux (I do not consider Windows atm). I didn’t find any CI service which supports Kotlin/Native out of the box.
s

sunbreak

05/23/2019, 9:25 AM
https://codemagic.io may be the answer. It's kind of official CI for Flutter. As Flutter using fastlane as command line tool, it's possible to run Kotlin/Native on CodeMagic, I guess
We are using own managed server as CI for both Kolint/MPP and Flutter, targeting iOS and Android. The gitlab-ci config are quite the same. And I bet you a try of CodeMagic
y

yshrsmz

05/23/2019, 9:39 AM
I've been using Bitrise. Bitrise has a vm for crossplatform solution(called hybrid stack), so you can use that.
In my bitrise setup I created two jobs, one is for building android part of the Kotlin MPP and the other is for iOS part, so that I can build & test concurrently
o

oleksandr.stepanov

05/23/2019, 11:36 AM
Cool, thank you both. I will give these tools a try.
e

egorand

05/23/2019, 12:07 PM
SQLDelight has Native, JVM and Android specific modules and uses Travis, there are config options to tell it which boxes to build on
https://github.com/square/sqldelight
k

kpgalligan

05/23/2019, 2:29 PM
I use appcenter for Stately and some others. Mostly point and click setup: https://github.com/touchlab/Stately
However, I hear that’s getting the shut down over time in favor of Azure Pipelines
Example https://github.com/benasher44/uuid/pull/9
View count: 5