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

    nestserau

    12/17/2018, 9:59 AM
    The second issue is an exception inside of ktor when I try to work with HttpClient:
    kotlin.ClassCastException: null cannot be cast to io.ktor.client.call.HttpClientCall
            at 0   test.kexe                           0x000000010f30b976 kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception + 70
            at 1   test.kexe                           0x000000010f30b896 kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException + 70
            at 2   test.kexe                           0x000000010f3a8206 kfun:kotlin.ClassCastException.<init>(kotlin.String?)kotlin.ClassCastException + 70
            at 3   test.kexe                           0x000000010f3b2cfb ThrowClassCastException + 379
            at 4   test.kexe                           0x000000010f3dcb23 CheckInstance + 67
            at 5   test.kexe                           0x000000010f4e5706 kfun:io.ktor.client.HttpClient.$execute$COROUTINE$1.invokeSuspend(kotlin.Result<kotlin.Any?>)kotlin.Any? + 422
            at 6   test.kexe                           0x000000010f4e5802 kfun:io.ktor.client.HttpClient.execute(io.ktor.client.request.HttpRequestBuilder)io.ktor.client.call.HttpClientCall + 130
    ...
    I’ve read earlier in this channel that it can be related to the version of Kotlin that I’m using (1.3.11), but the problem is, I cannot switch to 1.3.10 easily, because if I do, then it starts complaining about
    platform.CoreCrypto
    not being available. Does anyone know for sure that this error is related to Kotlin version or something else? How I use
    HttpClient
    is very simple:
    suspend fun <T> send(message: MessageStrategy<T>): MessageResult<T> {
    
            val request = message.buildRequest()
            val token = session.state.sessionKey
            ...
    
            val call = client.call(session.host) {
                method = <http://HttpMethod.Post|HttpMethod.Post>
                body = {
                    val encodedMessage = request.record.encode()
                    val bytes = ByteArray(encodedMessage.size) { encodedMessage[it].toByte() }
                    ByteArrayContent(bytes)
                }
            }
    
            ...
            return ...
        }
    }
    m
    • 2
    • 3
  • d

    darkmoon_uk

    12/17/2018, 2:13 PM
    From Kotin 1.3 Release Notes:
    In the old model, common and platform-specific code needed to be placed in separate modules, linked by expectedBy dependencies. Now, common and platform-specific code is placed in different source roots of the same module, making projects easier to configure.
    ...is that mandatory to follow now? All platforms being in the same module sounds like an unpleasantly tightly coupled workflow.
    h
    • 2
    • 1
  • d

    darkmoon_uk

    12/17/2018, 3:14 PM
    I was expecting to be able to write iOS
    UIViewController
    in Kotlin and have it conform to a Kotlin interface (an MVP 'View contract'). This is critical to implement the MVP UI pattern. Attempting hits the error "Mixing Kotlin and Objective-C super-types is not supported". Very unexpected and critical limitation of Kotlin/iOS 😞 Any ideas if this is likely to change in the future? For now considering creating an inline-class wrapper to fake 'implement' the ViewContract. Others doing similar?
    k
    • 2
    • 1
  • p

    pandawarrior

    12/18/2018, 4:52 AM
    Has anyone checked out cinterop yet? I tried to follow https://www.raywenderlich.com/7357-ios-app-with-kotlin-native-getting-started but the errors are always “..symbol(s) not found for architecture arm64”. I even tried to create a simple Objective C foobar class to link to Kotlin Native, but still failed with the same error.
    -.groovy
    o
    • 2
    • 1
  • s

    spierce7

    12/18/2018, 6:37 AM
    If I'm using the multiplatform plugin, and I want to pull in a multiplatform library that has multiple targets for the same platform, how do I choose which platform target is pulled in from the application?
    s
    l
    • 3
    • 5
  • u

    unixer

    12/18/2018, 1:08 PM
    does anybody try the ios part of https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html#creating-ios-application?
    n
    • 2
    • 1
  • u

    unixer

    12/18/2018, 1:10 PM
    Please see the words "The SharedCode build generates iOS frameworks for use with the Xcode project. All frameworks are in the SharedCode/build/bin folder"
    t
    e
    • 3
    • 4
  • j

    JoakimForslund

    12/18/2018, 3:11 PM
    In a multiplatform project, how would one go about to write a test for an asynchronous function(Currently using coroutines) in common code? The frameworks that exist seems to handle multiplatform setups pretty bad. I'd really want to write a simple REST call test to feel save about the current test suite
    d
    • 2
    • 7
  • t

    Taras Koshkin

    12/19/2018, 12:05 AM
    Hey all, is there a list of popular Multiplatform libraries that are kept somewhere?
    g
    k
    • 3
    • 3
  • n

    nestserau

    12/19/2018, 11:10 AM
    Is there a plan to make Kotlin generics available from Swift? It’s a shame I get untyped definitions in Swift, while Kotlin and Swift both support generics. I’m talking in the context of using an iOS framework produced from a MPP.
    ➕ 2
    g
    s
    c
    • 4
    • 5
  • p

    pandawarrior

    12/19/2018, 11:48 AM
    I tried to implement Realm on Android side of the MPP but it seems like
    kapt
    is not working properly.
    g
    i
    k
    • 4
    • 15
  • i

    Ivan

    12/19/2018, 6:05 PM
    is there a way to use syncronized block in native? ios. there is no @syncronized available
    r
    u
    • 3
    • 2
  • b

    Bhattachar

    12/19/2018, 7:08 PM
    Hi, I am new to this group. I am an iOS developer and looking for a common code to share with iOS and Android, especially httpClient, business logic and models. Was not sure where to start from. Any suggestions? Thank you, Deepthi
    k
    • 2
    • 7
  • a

    altavir

    12/20/2018, 7:33 AM
    Iv'e read somewhere that kotlin-mpp gradle plugin is or will be shortly compatible with kotlin dsl. Are there any examples for it?
    g
    m
    • 3
    • 5
  • p

    pajatopmr

    12/20/2018, 7:34 AM
    Having some trouble linking (for a macos target, running on macos) kotlinx.coroutines.* items while running tests that all pass successfully (all common tests) on the JVM. From all that I can discern, this should be working but I might have missed something.
    • 1
    • 2
  • n

    nestserau

    12/20/2018, 10:53 AM
    I’ve found an issue where Android and iOS expose different behavior. Having this piece of a unit test:
    val result = backend.send(LoginMessageStrategy(login))
    assertTrue(result is MessageResult.ok<SessionState>, "$result")
    val sessionState = (result as MessageResult.ok<SessionState>).value
    So the IDE complains about the “redundant” cast after
    assertTrue
    , but if I remove it, then the unit test fails for iOS with an exception saying
    value
    not found on
    result
    , so I have to keep it there and let the IDE and the compiler complain, but at least it works for both platforms! If there is a better place to report MPP issues, please let me know.
    t
    • 2
    • 3
  • r

    rockerhieu

    12/21/2018, 10:43 AM
    Hi, I'm trying out
    kotlin-multiplatform
    . I can import java dependencies and compile the project just fine. But Android Studio/Intellij failed to recognized the these dependencies. Is anyone running into the same issue?
    n
    j
    • 3
    • 8
  • i

    itnoles

    12/22/2018, 4:33 AM
    Does kotlin-platform-common supports Gradle 5.0?
    p
    l
    • 3
    • 4
  • a

    andreasmattsson

    12/23/2018, 11:28 AM
    Hm... Would anyone be able to assist me in writing the
    expected
    annotation class for a common module, in order to in the jvm module write
    actual typealias Headers = retrofit2.http.Headers
    ? Where the actual implementation is the following: https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/http/Headers.java I've tried a whole bunch of variations on
    vararg val value: String
    and
    val value: Array<String>
    but it seems regardless I get some variation on the error
    The following declaration is incompatible because return type is different
    ?
    t
    j
    • 3
    • 5
  • d

    Dominaezzz

    12/23/2018, 2:35 PM
    I get
    CreateProcess error=206, The filename or extension is too long
    when I build mingw part of multiplatform project but JVM builds fine.
    a
    • 2
    • 5
  • e

    egorand

    12/24/2018, 2:17 AM
    is there a way to add a custom configuration to a target? e.g.:
    kotlin {
      targets {
        fromPresets(presets.jvm, 'jvm') {
          configurations {
            baseline
          }
        }
      }
      jvmMain {
        dependencies {
          baseline 'com.squareup.okio:okio:1.14.1'
        }
      }
    }
    g
    • 2
    • 6
  • n

    Nikolai

    12/25/2018, 10:39 AM
    Hi everyone! Did anyone have any experience using OpenCV in android part of multiplatform project? I created multiplatform project in IDEA from scratch. After that I opened android part in Android Studio and followed steps from here : https://android.jlelse.eu/a-beginners-guide-to-setting-up-opencv-android-library-on-android-studio-19794e220f3c But after I imported new module gradle gave me an error (see the image). It’s possible to import OpenCV in usual way? Thanks.
    l
    g
    • 3
    • 8
  • r

    Robert

    12/26/2018, 9:22 AM
    Is there a channel/tracker where we can request new libraries to become multiplatform? For example I would love to use
    InetAddresses
    , but it is not compatible.
    a
    • 2
    • 11
  • r

    russhwolf

    12/26/2018, 8:30 PM
    Everything inside an
    expect class
    is implicitly also an
    expect
    declaration. So I think you’d need to leave it undefined and implement it as an
    actual
    . Or you might be able to do it as an extension property on
    BigInteger.Companion
    if you don’t want to define it for each platform.
    r
    • 2
    • 1
  • r

    Robert

    12/26/2018, 8:57 PM
    Should I extend java.math.Biginteger and alias that? Edit; hmm that doesnt seem to work out, return types etc are different class because of extending. Don't see how I add this companion object values to the type-alias...
    d
    • 2
    • 12
  • r

    rrader

    12/27/2018, 12:55 PM
    In JavaScript we have
    undefined
    value, what is equivalent in Kotlin?
    a
    • 2
    • 7
  • s

    Sergio Casero

    12/28/2018, 11:51 AM
    Hi guys, I'm getting strange issue, I'll try to explain. I have 1 module working with TornadoFX in a MPP project, and I can't run the program well from intellij, the behaviour is: -> run with
    gradlew desktop:run
    (application plugin) works -> run with
    tornado build config
    not working -> run with
    main method
    not working The issue for both is
    Could not find or load main class MainKt
    Looks like I'm not alone, because this user also gets the issue -> https://stackoverflow.com/questions/48777697/kotlin-multi-platform-error-could-not-find-or-load-main-class-mainkt
    l
    • 2
    • 4
  • j

    jotaramirez

    12/28/2018, 5:06 PM
    Hi guys, is possible use actors in kotlin multiplatform? I´m using org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1but not found. I need share cache but I can´t modify in iOS. Any help? Thanks
    j
    o
    • 3
    • 3
  • s

    serebit

    12/29/2018, 4:24 AM
    As of the latest EAP, the configuration in one of my projects for targets and source sets looks like this:
    -.kt
    😍 1
    j
    • 2
    • 2
  • p

    pajatopmr

    12/29/2018, 8:53 AM
    In my attempt to build a 1.3.20-eap-52 multi-platform app using custom libraries built with 1.3.11, I have encountered a build failure that might be a bug. That said, it could just as easily be a configuration issue with my code. I will post details and answer followup questions in this thread. Most importantly, it would be good to know if someone has a running 1.3.20-eap-52 multiplatform project with native code using Gradle 5.0, a Kotlin build script, and custom libraries built and published with a released version of Kotlin (1.3.11 or earlier).
    d
    j
    • 3
    • 10
Powered by Linen
Title
p

pajatopmr

12/29/2018, 8:53 AM
In my attempt to build a 1.3.20-eap-52 multi-platform app using custom libraries built with 1.3.11, I have encountered a build failure that might be a bug. That said, it could just as easily be a configuration issue with my code. I will post details and answer followup questions in this thread. Most importantly, it would be good to know if someone has a running 1.3.20-eap-52 multiplatform project with native code using Gradle 5.0, a Kotlin build script, and custom libraries built and published with a released version of Kotlin (1.3.11 or earlier).
Here’s the failing screen shot: Screen Shot 2018-12-29 at 3.39.11 AM.png
And the build script: Screen Shot 2018-12-29 at 3.55.19 AM.png
@h0tk3y @msink Can you please let me know if you think this is my issue (a problem with my code) or a JetBrains issue. Specifically the ABI version mismatch. Thanks.
d

Dico

12/29/2018, 9:31 AM
I think you're expected to use gradle 4.7 on multiplatform projects with native dependencies
:yes: 1
Maybe 4.8, I don't remember
p

pajatopmr

12/29/2018, 9:56 AM
Yes, my understanding is that 4.7 is required for Kotlin native to work for released Kotlin versions. I’m not sure yet what to expect with 1.3.20-eap-52. Answering that question is part of my goal in this effort, as well as to help uncover any relevant issues for JetBrains.
j

Jonas Bark

12/29/2018, 10:24 AM
I'm getting the exact same error
p

pajatopmr

12/29/2018, 11:34 AM
Good to know. Thanks.
d

Dico

12/29/2018, 4:44 PM
I don't see why the gradle version you need would change from 4.7 unless it's explicitly mentioned in the change log for the eaps.
p

pajatopmr

12/29/2018, 7:04 PM
@Dico Three things: 1) for Android, I need 4.10+; 2) working around a 4.7 issue for native is somewhat annoying; 3) change log for the eaps? How do I find that? Thanks.
View count: 6