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

    Taras Koshkin

    11/14/2018, 4:08 PM
    what gradle wrapper are you using?
    g
    • 2
    • 4
  • s

    Sangeet

    11/14/2018, 6:50 PM
    NSString().initWithData(ResponseData, NSUTF8StringEncoding)
    is throwing exception. Can anybody help me with this ?
    t
    o
    • 3
    • 3
  • n

    napperley

    11/15/2018, 1:49 AM
    Is there a way to pass through an array of structs (by reference) to a c function as a parameter? Need to supply entries to g_action_map_add_action_entries function ( https://developer.gnome.org/gio/stable/GActionMap.html#g-action-map-add-action-entries ). Currently I have a single entry (quitAction) passed through as a parameter which works fine:
    // ...
    val quitAction = cValue<GActionEntry> {
            name = quitActionName
            parameter_type = null
            activate = staticCFunction(::quitActivated)
    }.ptr
    // ...
    g_action_map_add_action_entries(app.reinterpret(), quitAction, 1, win)
    o
    • 2
    • 2
  • d

    Dico

    11/15/2018, 4:08 AM
    I'm struggling very much to get native dependencies working for native targets in multiplatform projects. Specifically, I'd like to add
    kotlinx-coroutines-core-native:1.0.1
    as a dependency on a platform using the
    mingwX64
    preset. When specifying this dependency, gradle is not able to resolve it, despite the correct repositories being referenced. When specifying
    common
    variant of the dependency, gradle is able to resolve it, but no symbols are accessible in IntelliJ. All references remain unresolved. I made a new barebones multiplatform project, and I have the same problem. I also tried
    kotlinx-serialization-runtime-native:0.9.0
    and coroutines version 1.0.0 and I got the same results on both attempts. Setting
    kotlin_native_version
    in gradle.properties has no effect.
    GRADLE_METADATA
    feature is enabled. Repositories are present. What else could be going wrong?
    o
    • 2
    • 8
  • k

    Konstantin Petrukhnov

    11/15/2018, 5:12 AM
    Do i understood correctly, that i could have Swift project with 2 kotlin libraries, so that each library initialized in different thread, and I could still pass some frozen objects between them?
    o
    s
    • 3
    • 2
  • g

    gildor

    11/15/2018, 11:18 AM
    Why
    vararg
    argument not available for ObjC interop in methods like NSString.stringWithFormat? Is this something that not supported yet, or has some unsolvable interop problems? https://developer.apple.com/documentation/foundation/nsstring/1497275-stringwithformat
    s
    • 2
    • 3
  • s

    Sam

    11/15/2018, 1:09 PM
    I have an odd issue I’m experiencing. I’m getting a crash in a swift codebase calling into a companion obeject. The message is being sent to the wrong companion object and it is crashing. More details in the thread.
    s
    • 2
    • 9
  • l

    loudedtwist

    11/15/2018, 8:29 PM
    I am trying to compile the simplest example from the kotlin native tutorial page on mac and at first it did compile it, but now I get this error message: "error: compilation failed: Unexpected file extension: DS_Store". Do you know what could it be ?
    s
    • 2
    • 3
  • d

    drofwarcs

    11/15/2018, 9:34 PM
    Anyway to have cinterop change the name of a function when building? I'm bringing in OCHamcrest and cinterop fails with
    common/build/classes/kotlin/ios/main/common-cinterop-ochamcrest.klib-build/kotlin/org/ochamcrest/ochamcrest.kt:127:5: error: expecting function name or receiver type
    fun is(value: Any?): Any {
        ^
    The problem is the name of the function is a Kotlin keyword,
    is
    . I verified that manually changing the name in the objc header allowed cinterop to build.
    i
    l
    s
    • 4
    • 5
  • a

    AnaR

    11/15/2018, 9:50 PM
    Our first cross-platform app just went live on iOS. The 2D edu games are all written in Kotlin-Native. Best part is that its a single source-code to maintain (for 80% of it). So, we are converting all our games to Kotlin-Native. The profile, and report screens are still platform-specific. https://itunes.apple.com/app/id1436758342
    :kotlin-flag: 2
    🎉 11
    g
    t
    t
    • 4
    • 4
  • d

    Dico

    11/16/2018, 4:26 AM
    Given the behaviour of kotlin-native with regards to freezing all singletons by default (https://github.com/JetBrains/kotlin-native/blob/master/CONCURRENCY.md), and the circumstance of having singletons with mutable data in common sources of a multiplatform project, is it possible to disable these limitations? The file I linked doesn't really explain the benefits of the described behaviour, and while I understand that there are some benefits, I think it is honestly quite silly, especially in multiplatform projects, that there is no way to disable it. What is the technical reason behind that, assuming there is one?
    k
    o
    • 3
    • 9
  • f

    florent

    11/16/2018, 7:59 AM
    Can someone explain me the concept of frozen ? I created a class that contains a MutableMap, I got a frozen exception when I try to put an element inside
    g
    y
    +2
    • 5
    • 56
  • a

    AllowFlame

    11/16/2018, 8:50 AM
    -.txt
    g
    • 2
    • 2
  • l

    Landerl Young

    11/16/2018, 1:31 PM
    How to share code with Android(Kotlin/JVM) and iOS(Kotlin/Native), since they have difference concurrency model. In the [officeial guide](https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html) and [Kotlin conf](https://github.com/JetBrains/kotlinconf-app), we can see in the commonMain sourcesets one can’t use Kotlin/Naive function to freeze an object to create a
    DetachedObjectGraph
    nor to use
    Worker
    . What if the commonMain have concurreny logic and I want to share those with Android and iOS?
    g
    • 2
    • 3
  • d

    Dinu

    11/16/2018, 2:49 PM
    it looks like
    Segmentation fault: 11
    is caused by something else rather then sleep, sleep is actually working..
    k
    • 2
    • 1
  • k

    kpgalligan

    11/16/2018, 5:14 PM
    error: unresolved reference: success
    o
    • 2
    • 9
  • n

    napperley

    11/16/2018, 11:26 PM
    What version of Kotlin Native is included in Kotlin 1.3.10?
    m
    o
    • 3
    • 3
  • v

    ValV

    11/17/2018, 2:30 AM
    What does this error mean? I.e. where shall start looking for the propblem's roots? Any hints?
    msg.txt
    :thread-please: 2
    k
    o
    m
    • 4
    • 15
  • s

    serebit

    11/18/2018, 8:19 PM
    How exactly should I unit test kotlin native code?
    g
    • 2
    • 5
  • s

    serebit

    11/18/2018, 9:05 PM
    And now the compiler keeps crashing. Not sure what's causing it though.
    g
    n
    o
    • 4
    • 18
  • s

    Sam

    11/19/2018, 2:59 AM
    In Kotlin Native how would I find the number of bytes in a utf-8 string?
    @Test
        fun `The number of bytes in a euro is three`(){
            //count and length return 1 but a euro symbol is a multibyte character
            assertEquals(3, "€".count, "Wrong number of bytes for a Euro.") 
        }
    s
    m
    • 3
    • 3
  • r

    russhwolf

    11/19/2018, 5:06 AM
    I’ve been trying to use XCTestExpectation (https://developer.apple.com/documentation/xctest/asynchronous_tests_and_expectations/testing_asynchronous_operations_with_expectations?language=objc) from Kotlin/Native but having symbol-not-found issues. I suspect a cinterop problem but could use some hints. Details in thread
    s
    o
    d
    • 4
    • 7
  • h

    hmole

    11/19/2018, 9:22 AM
    Does
    memScoped
    still performs cleanup if an error occurs inside the block?
    s
    • 2
    • 1
  • j

    josephivie

    11/20/2018, 3:27 AM
    Consider a frozen object with unique properties that performs calculations that you wish to cache the results of. Where would you recommend caching the results? The object itself is frozen, so I can't store anything there. There are no guarantees about how long it will stick around. As such, I can't use a thread-local hash map because it would retain strong references. Is there a weak map implementation that could at least cache per-thread?
    m
    c
    • 3
    • 2
  • j

    josephivie

    11/20/2018, 3:28 AM
    Even better, perhaps some kind of concurrent map? The cached results would be the same across threads, and could safely be frozen the moment they were computed.
    o
    h
    k
    • 4
    • 6
  • c

    ckchen

    11/20/2018, 5:56 AM
    I am new to k/n. Why are there two gradle plugins (https://kotlinlang.org/docs/reference/native/gradle_plugin.html and https://kotlinlang.org/docs/tutorials/native/gradle-for-kotlin-native.html)? Does it mean one of them will be deprecated in the future? Also, how about the kotlin-dsl support of them?
    s
    n
    m
    • 4
    • 9
  • k

    kyonifer

    11/20/2018, 7:22 PM
    Im trying to generate a shared library for a setup with a project A which depends on another project B. It this a supported case? It seems to generate a single `.h`/`dylib` pair that only exposes symbols from project A.
    o
    • 2
    • 3
  • k

    Kaden Wilkinson

    11/20/2018, 11:50 PM
    Is it currently possible to depend on 3rd party libraries in a Kotlin Multi-platform library project? e.g. I want to write an auth library that wraps Auth0.swift and Auth0.Android that produces a iOS framework and android jar
    j
    y
    • 3
    • 12
  • y

    yuya_horita

    11/21/2018, 2:34 AM
    Currently, coroutines are supported only for main thread. So, http call with coroutines does not block main thread. But, in iOS, main queue (which manages main thread) is a serial queue. This means one processing will be performed after other processing queued previously have done. This is a problem in case of these. - calling many http requesting at once. (should be done concurrently.) - calling http request after heavy processing like image processing.
    o
    • 2
    • 8
  • s

    Sam

    11/21/2018, 10:12 PM
    Are there any documents/articles somewhere that walks a person through publishing a native library?
    l
    k
    • 3
    • 4
Powered by Linen
Title
s

Sam

11/21/2018, 10:12 PM
Are there any documents/articles somewhere that walks a person through publishing a native library?
l

Landerl Young

11/22/2018, 2:16 AM
check this out https://kotlinlang.org/docs/tutorials/multiplatform-library.html
k

kpgalligan

11/22/2018, 2:23 AM
Publishing externally (bintray/mavencentral) has some wrinkles. Also depends on gradle version. The metadata for gradle 4.7 is 0.3 and for 4.10 is 0.4, and they are incompatible. Most of the JetBrains libraries are 4.7, but hopefully moving towards 4.10 soon as new android studio wants that. I just spent the good part of a flight wrestling with kotlinx.coroutines trying to publish on 4.10
Sqldelight publishes to mavencentral on 4.10. I started moving my libraries to that. I also have a hack of JetBrains hack of the bintray gradle plugin to publish to bintray with gradle 4.10, but that’s not pushed to my fork yet. Can do later if somebody wants
s

Sam

11/22/2018, 4:51 PM
I went the “easier” route with 4.7 for the time being. For someone who is mostly an iOS dev, the least amount of Gradle I can do, the better. It is frustrating to lose a day of productivity trying to work out odd Gradle issues. It took a couple hours to figure out how to get the the Bintray Plugin to upload all of the artifacts and not just the Pom file. Thanks for the help. I’m sure I would still be struggling through this without it.
View count: 5