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

    hmole

    01/24/2019, 11:48 AM
    What's the difference between
    stdlib
    and
    stdlib-common
    ?
    h
    • 2
    • 1
  • a

    addamsson

    01/24/2019, 1:31 PM
    How do I run tests in a javascript module of a kotlin MPP? I see in the docs that I need to set it up manually but I only see examples for the old way not for the new
    kotlin-multiplatform
    plugin.
    h
    r
    • 3
    • 2
  • d

    Dominaezzz

    01/24/2019, 3:28 PM
    afterEvaluate {
    		kotlin.sourceSets.all {
    			languageSettings {
    				enableLanguageFeature('InlineClasses')
    				useExperimentalAnnotation('kotlin.ExperimentalUnsignedTypes')
    			}
    		}
    	}
    I have this in my root project
    build.gradle
    file inside a
    subprojects
    block. When I convert the file to kotlin dsl, I get "sourceSets could not be resolved". Not sure how to covert that bit from groovy to kotlin.
    • 1
    • 1
  • b

    Brian

    01/24/2019, 3:45 PM
    After upgrading to 1.3.20 my generated xcode framework changed their names (which results in quite some compilation errors). What would be the Gradle-way to control how the framework is named?
    j
    h
    m
    • 4
    • 7
  • d

    Drew

    01/24/2019, 4:40 PM
    Does anyone know how to generate the
    kotlin.js
    from a
    js
    mpp target?
    h
    a
    • 3
    • 13
  • d

    Diego

    01/24/2019, 5:05 PM
    Hello guys. I’m working on a multiplatform library. I have a method on my common module that returns
    ByteArray
    . When I import the framework from an iOS project, the ByteArray is converted to
    KotlinByteArray
    but I thought I would have a
    NSData
    in swift 😢 I think a solution would be to pass the ByteArray encoded as
    Base64
    . Is there a better way to convert a ByteArray to NSData?
    d
    • 2
    • 3
  • b

    basher

    01/24/2019, 5:47 PM
    Are we supposed to use the
    check
    task to run tests in kotlin-multiplatform for the common code? I'm running check, and it's succeeded but isn't really doing anything
    d
    • 2
    • 13
  • j

    jw

    01/24/2019, 5:48 PM
    common code tests don't run directly. they only run when materialized for a specific platform
    h
    • 2
    • 2
  • k

    kgonyon

    01/24/2019, 8:18 PM
    Updated_to_1_3_20_and_I_am_now_getting_the_following_error_in_the__linkMainDebugFrameworkIos_task.txt
    s
    h
    • 3
    • 4
  • b

    basher

    01/24/2019, 9:30 PM
    Figured out how to run tests for iOS:
    xcrun simctl spawn '<sim name like iPad Air 2>' <path to test.kexe>
    a
    i
    r
    • 4
    • 23
  • y

    yshrsmz

    01/25/2019, 8:07 AM
    kotlin {
      iosX64('ios') {
        binaries {
          framework()
        }
      }
    }
    In 1.3.20 when I try to create framework for iOS with above config, looks like link task name is
    linkDebugFrameworkIos
    , but
    kotlin.targets.ios.compilations.main.linkTaskName('FRAMEWORK', 'DEBUG')
    is
    linkMainDebugFrameworkIos
    .
    i
    • 2
    • 2
  • r

    ribesg

    01/25/2019, 10:12 AM
    Is there an example of a full Kotlin MPP Mobile project? I mean Gradle Kotlin DSL, Android & iOS app with 100% Kotlin
    ➕ 1
    b
    • 2
    • 21
  • a

    alexfacciorusso

    01/25/2019, 11:12 AM
    Hi guys! Does anyone know how to suppress the tests to be executed for the iOS platform on a shared module on
    build
    ? In particular, we are using MockK for mocking, that hasn’t got native support, so we’d like only the jvm/android tests to be executed when the
    build
    task is called on Gradle
    e
    r
    • 3
    • 8
  • d

    Dominaezzz

    01/25/2019, 2:40 PM
    Anyone know of any multiplatform math library, particularly for graphics, like glm?
    b
    • 2
    • 3
  • r

    ribesg

    01/25/2019, 2:54 PM
    I’m trying to write an MPP Android & iOS Kotlin project from scratch. Do you really need to have the “main”
    android {…}
    block in the top build.gradle file? EDIT: see thread
    k
    • 2
    • 20
  • c

    coletz

    01/25/2019, 5:24 PM
    Is it possible to use gradle > 4.10.1 with mpp? I am using IntelliJ IDEA 2018.1.3 with
    com.android.tools.build:gradle:3.3.0
    and I am getting
    Minimum supported Gradle version is 4.10.1. Current version is 4.7.
    . Afaik one need gradle 4.7 in order to compile working MPP
    d
    • 2
    • 1
  • d

    drofwarcs

    01/25/2019, 8:56 PM
    On 1.3.20 what is the proper why to disable bitcode for libs brought in via cinterops under debug iosX64 builds? Tried adding
    extraOpts '-Xembed-bitcode-marker'
    but get the following warning on each build:
    warning: Flag is not supported by this version of the compiler: -Xembed-bitcode-marker
    and the build eventually fails stating the library I'm bringing in with cinterops does not contain bitcode.
    s
    • 2
    • 2
  • g

    galex

    01/26/2019, 6:05 AM
    Do someone know how to add a sourceset to the android target?
    d
    • 2
    • 22
  • c

    coletz

    01/26/2019, 1:35 PM
    ok just kidding, not working anymore on both projects... no idea why or what to do
    r
    • 2
    • 12
  • n

    natpryce

    01/26/2019, 10:28 PM
    It’s only when run in the IntelliJ test runner that the test that requires the resource to be present fails
    e
    • 2
    • 3
  • a

    alec

    01/27/2019, 3:05 AM
    https://twitter.com/Strongolopolis/status/1089358385655369729
    🔥 4
    g
    j
    +2
    • 5
    • 13
  • a

    alec

    01/27/2019, 1:57 PM
    it has to apply for the entire build of that project
    b
    • 2
    • 1
  • a

    alec

    01/27/2019, 2:16 PM
    https://github.com/JetBrains/kotlin-mpp-example
    c
    • 2
    • 5
  • b

    bdeg

    01/27/2019, 4:45 PM
    is there a way to achieve this:
    //For ios target (emulator or real device)
            final def iosTarget = System.getenv("SDK_NAME")?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64
            fromPreset(iosTarget, 'ios') {
                compilations.main.outputKinds('FRAMEWORK')
            }
    in the new 1.3.20 mpp plugin ? i tried: def buildForDevice = project.findProperty("device")?.toBoolean() ?: false (buildForDevice) ? iosArm64("ios") : iosX64("ios") targets.compilations["ios"] { compilations.main.outputKinds("framework") binaries { framework { // Disable bitcode embedding for the simulator build. if (!buildForDevice) { embedBitcode("disable") } } } } also:
    def buildForDevice = project.findProperty("device")?.toBoolean() ?: false
        def ios = (buildForDevice) ? iosArm64("ios") : iosX64("ios")
        ios {
            compilations.main.outputKinds("framework")
    
            binaries {
                framework {
                    // Disable bitcode embedding for the simulator build.
                    if (!buildForDevice) {
                        embedBitcode("disable")
                    }
                }
            }
        }
    d
    c
    r
    • 4
    • 24
  • r

    ribesg

    01/28/2019, 10:57 AM
    What makes
    compilations
    of an
    android
    target appear?
    d
    • 2
    • 7
  • n

    natpryce

    01/28/2019, 11:34 AM
    Does the kotlin-multiplatform plugin create standard source-sets that are dependencies of all native targets? E.g. it creates the standard commonMain and commonTest source sets, which are dependencies of all targets, which can contain code that uses kotlin-stdlib-common. Is there equivalent for native targets, which relies on stdlib features common to all native platforms? (is that even a thing?)
    i
    m
    t
    • 4
    • 7
  • a

    alexfacciorusso

    01/28/2019, 12:42 PM
    hey guys, silly question: what's the best way of formatting a Float/Double to String with a given number of decimals in Kotlin common?
    a
    m
    • 3
    • 3
  • c

    coolcat

    01/28/2019, 12:56 PM
    Hi. Has anybody succeeded in producing an iOS framework containing both arm32 and arm64 binaries? Currently my project is set up using the build script recommended in the Multiplatform tutorial (https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html) but this produces only a 64-bit framework.
    j
    • 2
    • 1
  • r

    ribesg

    01/28/2019, 1:04 PM
    I still didn’t find a solution to this, my
    android
    target has no
    compilation
    r
    h
    • 3
    • 6
  • n

    natpryce

    01/28/2019, 3:11 PM
    How does one diagnose the cause of an “Invalid module” build error? When compiling tests for the macosX64 target, my build fails with an enormous error message that includes what looks like LLVM bitcode of the compiled module, and eventually ends with:
    * Compiler version info: Konan: 1.1.1 / Kotlin: 1.3.20
     * Output kind: PROGRAM
    
    exception: java.lang.Error: Invalid module
            at org.jetbrains.kotlin.backend.konan.llvm.IrToBitcodeKt.verifyModule(IrToBitcode.kt:179)
            at org.jetbrains.kotlin.backend.konan.llvm.IrToBitcodeKt.verifyModule$default(IrToBitcode.kt:170)
    What can I do to resolve the error?
    s
    • 2
    • 9
Powered by Linen
Title
n

natpryce

01/28/2019, 3:11 PM
How does one diagnose the cause of an “Invalid module” build error? When compiling tests for the macosX64 target, my build fails with an enormous error message that includes what looks like LLVM bitcode of the compiled module, and eventually ends with:
* Compiler version info: Konan: 1.1.1 / Kotlin: 1.3.20
 * Output kind: PROGRAM

exception: java.lang.Error: Invalid module
        at org.jetbrains.kotlin.backend.konan.llvm.IrToBitcodeKt.verifyModule(IrToBitcode.kt:179)
        at org.jetbrains.kotlin.backend.konan.llvm.IrToBitcodeKt.verifyModule$default(IrToBitcode.kt:170)
What can I do to resolve the error?
s

svyatoslav.scherbina

01/28/2019, 3:34 PM
This is internal compiler error, probably caused by a compiler bug.
Could you provide code to reproduce the issue?
n

natpryce

01/28/2019, 3:35 PM
I’ll push the current state of the project to a branch, and create a youtrack issue
:tnx: 1
https://youtrack.jetbrains.net/issue/KT-29542
Also https://youtrack.jetbrains.net/issue/KT-29543
I’ve raised two issues from that branch. I also may have found a bug with the kotlin-test-junit5 library but I’m not sure if it’s not actually my mistake. When I change the dependency of my tests from kotlin-test-junit to kotlin-test-junit5, Gradle finds none of the tests, although they all run in IntelliJ.
I’m not sure if I need to add more config to Gradle to make kotlin-test-junit5 work
s

svyatoslav.scherbina

01/29/2019, 9:16 AM
Thank you. We have successfully reproduced KT-29542 and are investigating it.
n

natpryce

01/29/2019, 9:53 AM
Thank you.
View count: 5