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

    Yuku Kotani

    04/10/2019, 3:27 PM
    Is there any way to control dom tree with webassembly? I only found examples with canvas.
    r
    s
    o
    • 4
    • 6
  • a

    azeDevs

    04/11/2019, 2:38 AM
    I've been lost on how to do this for days now. 😩
    private val apiThread = Worker.start()
    
    private fun startUiLoop() {
        apiThread.execute(TransferMode.SAFE, { Unit }) {
            sleep(2000)
            updateUi()
        }.consume { startUiLoop() }
    }
    I'm stumped on the syntax here (or a K/N solution in general) for a simple timed interval loop. I have Windows C libraries implemented, if that changes things.
    k
    o
    m
    • 4
    • 8
  • s

    sunbreak

    04/11/2019, 4:19 PM
    https://github.com/JetBrains/kotlin-native/releases/tag/v1.2.0 https://github.com/JetBrains/kotlin-native/releases/tag/kotlin-1.3.20 A little confused by the release tags. Which one is susposed compatible with [kotlin-1.3.30](https://github.com/JetBrains/kotlin/releases/tag/v1.3.30)?
    s
    • 2
    • 2
  • g

    gildor

    04/12/2019, 5:55 AM
    Someone from K/N team, should this page be updated with Kotlin/Native platfrom plugin and also mention MPP plugin as one of options? https://kotlinlang.org/docs/tutorials/native/gradle-for-kotlin-native.html Konan doesn’t work with new Gradle and probably already outdated in general
    j
    d
    • 3
    • 11
  • a

    AregevDev

    04/12/2019, 8:29 AM
    Hi, what's going on here?
    m
    s
    • 3
    • 5
  • d

    David

    04/12/2019, 9:40 AM
    I am using a AppCode generated project to build a multiplatform framework (will run on iOS). The target is defined with the following lines:
    kotlin {
        xcode {
            setupFramework("InsNativeFramework")
        }
    }
    I can’t find any documentation on the
    xcode
    target. Does it fetch the settings from the Xcode project? How do I set the target platform for example?
    s
    • 2
    • 3
  • m

    mben

    04/12/2019, 12:06 PM
    Hello how can we only import android.util.Log inside commonAndroid pleaz?
    j
    • 2
    • 9
  • k

    kpgalligan

    04/12/2019, 1:49 PM
    Any good docs on new AppCode plugin? Using that with and existing and/or android project (not to run android, but to develop/test iOS part)?
    t
    • 2
    • 2
  • d

    drofwarcs

    04/12/2019, 7:41 PM
    Has anyone else run into the following error after upgrading to 1.3.30, and have a workaround
    > Task :common:linkDebugFrameworkIos
    e: Compilation failed: org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl@6c61d6d9 not in vtable of org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl@641449e4
    .......
    .......
     * Compiler version info: Konan: 1.2 / Kotlin: 1.3.30
     * Output kind: FRAMEWORK
    .......
    i
    s
    • 3
    • 6
  • t

    tylerwilson

    04/12/2019, 8:04 PM
    Trying to add ktor/coroutines to AppCode 2019.1 generated Framework. No love. I have a build.gradle.kts which appears to result in the right libs being added - they show up in the gradle toolpane. But AppCode does not recognize import io.ktor or kotlinx.coroutines. Anybody else see this? What is the magic for dependencies to be seen in editor?
    -.txt
    d
    • 2
    • 15
  • k

    Kaden Wilkinson

    04/12/2019, 8:57 PM
    Also
    Task :generateDefReact
    for the React pod generates some bad defs. Not sure where that should be reported
    error: /path/to/project/build/classes/kotlin/ios/main/LibraryName-cinterop-React.klib-build/kotlin/cocoapods/React/React.kt: (2970, 23): 'toString' hides member of supertype 'NSObject' and needs 'override' modifier
    
    error: /path/to/project/build/classes/kotlin/ios/main/LibraryName-cinterop-React.klib-build/kotlin/cocoapods/React/React.kt: (15835, 25): 'public final var attributedText: NSAttributedString defined in cocoapods.React.RCTUITextView' clashes with 'public final var attributedText: NSAttributedString? defined in cocoapods.React.RCTBackedTextInputViewProtocolProtocol': property types do not match
    d
    • 2
    • 3
  • j

    Jurriaan Mous

    04/13/2019, 10:16 AM
    After upgrading to kotlin 1.3.30 I get this stacktrace on one of my bigger multiplatform modules. Any tips on finding the issue? (Works in JS/JVM and older kotlin native) Is there any way to get more context information? It fails in the
    linkTestDebugExecutableMacos
    task.
    * Compiler version info: Konan: 1.2 / Kotlin: 1.3.30
     * Output kind: PROGRAM
    
    e: java.lang.IllegalStateException: org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor@36d848af is not bound
    	at org.jetbrains.kotlin.backend.common.descriptors.WrappedDeclarationDescriptor.getOwner(WrappedDescriptors.kt:97)
    	at org.jetbrains.kotlin.backend.common.descriptors.WrappedPropertyDescriptor.getName(WrappedDescriptors.kt:741)
    	at org.jetbrains.kotlin.backend.konan.lower.PropertyDelegationLowering.createKProperty(DelegationLowering.kt:265)
    	at org.jetbrains.kotlin.backend.konan.lower.PropertyDelegationLowering.access$createKProperty(DelegationLowering.kt:44)
    	at org.jetbrains.kotlin.backend.konan.lower.PropertyDelegationLowering$lower$1.visitPropertyReference(DelegationLowering.kt:133)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitPropertyReference(IrElementTransformerVoid.kt:191)
    	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitPropertyReference(IrElementTransformerVoid.kt:24)
    	at org.jetbrains.kotlin.ir.expressions.impl.IrPropertyReferenceImpl.accept(IrPropertyReferenceImpl.kt:42)
    	at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:27)
    d
    o
    • 3
    • 5
  • l

    lsk

    04/13/2019, 7:03 PM
    I am running multi-platform build 1.3.30 on windows and it fails on
    Error occurred during initialization of VM. Could not reserve enough space for 3145728KB object heap
    Gradle starts cinterop with
    -Xmx3G
    . How can I decrease it?
    t
    • 2
    • 2
  • g

    galex

    04/13/2019, 7:32 PM
    Hello, I am trying to build my multiplatform project to iOS on 1.3.30 and after upgrading a few versions like ktor and coroutines I got the following error:
    e: Compilation failed: Could not find "kotlinx-coroutines-core-native" in [...]`
    The dependencies of the iOS project are set up like this:
    iosMain.dependencies {
                implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$kotlinx_coroutines_version"
                implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$kotlinx_serialization_version"
                implementation "io.ktor:ktor-client-json-native:$ktor_version"
                implementation "io.ktor:ktor-client-ios:$ktor_version"
            }
    Any idea why it can’t find that lib?
    d
    • 2
    • 16
  • l

    lsk

    04/14/2019, 8:40 AM
    compiling my project on Windows and I get this error with duplicate stdlibs definitions. What could this mean?
    Task :cinteropMylapsMingwX64 FAILED
    
    Exception in thread "main" java.lang.Error: C:\Users\adams\.konan\dependencies\msys2-mingw-w64-x86_64-gcc-7.3.0-clang-llvm-lld-6.0.1\x86_64-w64-mingw32\include\sec_api/string_s.h:37:27: error: conflicting types for 'strcpy'
            at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:133)
            at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:959)
            at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:951)
            at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:74)
            at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:229)
            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)
    
    FAILURE: Build failed with an exception.
    d
    m
    • 3
    • 9
  • d

    Dominaezzz

    04/14/2019, 2:00 PM
    I'm trying to consume an android executable build with Kotlin/Native but I keep getting
    couldn't find "libc++_shared.so"
    . Can the compiler statically include it instead?
    o
    • 2
    • 1
  • g

    gianluz

    04/14/2019, 6:33 PM
    Hello!! 🙂 i would like to execute a .kts file that have as dependency a library.. but looks like this library is using Gson that is not resolved.. this is the command i’m running
    kotlinc -cp path/to/my/library.jar -script ScriptFile.kts
    any idea?
    t
    • 2
    • 1
  • g

    galex

    04/14/2019, 7:11 PM
    Is there any way to not have to write
    return KotlinUnit()
    in every lambda/closure in Swift when using kotlin code?
    s
    • 2
    • 2
  • g

    galex

    04/14/2019, 7:12 PM
    What about a generic parameter of the lambda? I see it being recognized in swift as
    Any?
    s
    • 2
    • 1
  • b

    basher

    04/15/2019, 1:09 AM
    Anyone get this kind of Unsupported operation exception upgrading to Kotlin 1.3.30: https://github.com/JetBrains/kotlin-native/issues/2867 ?
    • 1
    • 1
  • t

    Tobi

    04/15/2019, 8:31 AM
    Hey folks, I am currently working on a multiplatform library for android/ios involving some hashing. As part of this I need a hmac function using SHA-256. Above you can see the implementation I have for the JVM, now I wonder how I can implement this using Kotlin/Native. I found this swift example (https://gist.github.com/thewheat/7342c76ade46e7322c3e#gistcomment-1769792), which does more or less what I need, despite it gives me a
    String
    instead of a
    ByteArray
    , but I am still a bit lost what are the required steps. Since the above linked swift example just requires
    Foundation
    , should I try to convert this to kotlin in the native platform source set? Thanks in advance.
    hmac_SHA-256_function.kt
    o
    • 2
    • 2
  • j

    JoakimForslund

    04/15/2019, 9:04 AM
    Any chance of https://github.com/JetBrains/kotlin-mpp-example being updated to follow the 1.3.30 spec?
    i
    • 2
    • 1
  • b

    basher

    04/15/2019, 3:54 PM
    I get this message only building for native targets:
    'performAndWait(suspend CoroutineScope.() -> T): T' is deprecated. Experimental coroutines support will be dropped in 1.4
    This method is my own, and I can't figure out what about this signature triggers the deprecation warning. Anyone else run into this?
    g
    • 2
    • 9
  • l

    lsk

    04/15/2019, 4:41 PM
    once I compile my app to exe file on Windows, I start it and it ends without any message. This means there are no related DLLs. If I copy DLLs the to same dir, it works. Can I somehow handle this error and say that DLLs are missing?
    d
    • 2
    • 11
  • t

    toomanyeduardos

    04/16/2019, 4:24 AM
    file size question! when you include a basic KN framework to your iOS project, by how much did your iOS output app size increase? same question with Android. I know this answer could be all over the place (if your KN has a 200mb video, then it obviously would increase the app by 200mb+), but a rough estimate would be wonderful. Even a basic hello world comparison would help me at this point. Thanks!
    g
    o
    • 3
    • 4
  • s

    Smallville7123

    04/16/2019, 7:55 AM
    https://kotlinlang.slack.com/archives/C0922A726/p1555400679200800
    s
    o
    • 3
    • 7
  • t

    Tobi

    04/16/2019, 8:40 AM
    Hey folks, as part of my multiplatform library I want to write some unit tests in xcode using the generated framework. I successfully linked the framework as embedded binary and can use it in the code, but I get an error when referencing it from the tests. I created an xcode project with unit tests and added
    @testable import main
    to the test, where
    main
    is the kotlin/native framework.
    Linker_error_xcode_tests.swift
    s
    • 2
    • 2
  • m

    mben

    04/16/2019, 3:45 PM
    Hello little problem here when trying to add 'io.mockk:mockk-common' i cant use it inside my commonTest folder even if i do inside my gradle : commonTest.dependencies { implementation 'org.jetbrains.kotlin:kotlin-test' implementation 'org.jetbrains.kotlin:kotlin-test-junit' implementation 'io.mockk:mockk-common:1.9.3' } any help?
    a
    k
    • 3
    • 5
  • s

    Smallville7123

    04/17/2019, 1:47 AM
    is there any way to tell if a debug build is being built or not
    o
    i
    • 3
    • 13
  • t

    Tobi

    04/17/2019, 8:23 AM
    Hey folks, I am trying to implement a hmac sha256 function following this example (https://kotlinlang.slack.com/archives/C3SGXARS6/p1544768698174600?thread_ts=1541771174.265700&cid=C3SGXARS6 ), but that results in a
    SIGABRT
    when running it from xcode. Could anyone give me a hand on this? Thanks in advance.
    hmac_sha_256_function.kt
    o
    • 2
    • 2
Powered by Linen
Title
t

Tobi

04/17/2019, 8:23 AM
Hey folks, I am trying to implement a hmac sha256 function following this example (https://kotlinlang.slack.com/archives/C3SGXARS6/p1544768698174600?thread_ts=1541771174.265700&cid=C3SGXARS6 ), but that results in a
SIGABRT
when running it from xcode. Could anyone give me a hand on this? Thanks in advance.
hmac_sha_256_function.kt
o

olonho

04/17/2019, 8:34 AM
why not follow example as is? cast of
ByteArray
to
CValuesRef<ByteVar>
doesn’t make sense, please use approach with pinned data
➕ 1
t

Tobi

04/17/2019, 1:51 PM
Thanks, I did that and made it work. Posting that here in case someone else needs it
actual object Hmac256Encoder {
    @ExperimentalUnsignedTypes
    actual fun encode(key: ByteArray, value: String): ByteArray {
        val input = value.toUtf8()
        val digest = UByteArray(CC_SHA256_DIGEST_LENGTH)
        key.usePinned { keyPinned ->
            input.usePinned { inputPinned ->
                digest.usePinned { digestPinned ->
                    CCHmac(kCCHmacAlgSHA256, keyPinned.addressOf(0), key.size.convert(), inputPinned.addressOf(0), input.size.convert(), digestPinned.addressOf(0))
                }
            }
        }
        return digest.toByteArray()
    }
}
View count: 28