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

    Artur Matsehor

    10/03/2020, 9:11 PM
    Hi Is there a way to make data classes with default parameter values work properly in Swift? Example:
    data class State @JvmOverloads constructor(
        val loading: Boolean = false,
        val data: ResponseBody? = null,
        val error: ApiError? = null
    )
    In Swift, it is resolved to
    init(loading: Bool, data: ResponseBody?, error: ApiError?)
    Neither with overloads or default values
    👀 1
    d
    m
    • 3
    • 10
  • d

    darkmoon_uk

    10/04/2020, 11:08 AM
    Is this a bug or an expected limitation with inline classes vs. companion objects vs. Parcelable?
    s
    • 2
    • 2
  • r

    Robert Jaros

    10/04/2020, 12:12 PM
    Anyone have managed to use
    @JsonTypeInfo
    from jackson in the common source of MPP project? I have tried to create expected annotation like this:
    expect annotation class JsonTypeInfo(val use: Id, val property: String) {
        enum class Id {
            CLASS
        }
    }
    but
    actual typealias JsonTypeInfo = com.fasterxml.jackson.annotation.JsonTypeInfo
    doesn't compile (fails with the Id enum class)
    • 1
    • 1
  • r

    rnett

    10/05/2020, 1:43 AM
    I'm having a weird dependency issue when I try to include a multiplatform project in another multiplatform project's js source set (both projects use JS IR) via
    implementation(project(...))
    . The dependency block looks like:
    val jsMain by getting {
        dependencies {
            implementation(project(":krosstalk-ktor-client"))
        }
    }
    but causes (in
    kotlinNpmInstall
    )
    Error: Couldn't find package "krosstalk-krosstalk-ktor-client@1.0.3-ALPHA" required by "krosstalk-fullstack-sample@1.0.3-ALPHA" on the "npm" registry.
        at MessageError.ExtendableBuiltin (C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:721:66)
        at new MessageError (C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:750:123)
        at PackageRequest.<anonymous> (C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:36539:17)
        at Generator.throw (<anonymous>)
        at step (C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:310:30)
        at C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:323:13
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
    This was working fine before I published the package, and it works fine when I include it without using
    project
    (i.e.
    implementation("com.rnett.krosstalk:krosstalk-ktor-client:$krosstalk_version")
    )
    b
    • 2
    • 2
  • a

    Aleksandr Ivanov

    10/05/2020, 12:44 PM
    Hi there, Not found an answer - now I’m building a library for android/ios and plan to distribute it for iOS via cocoapods. I managed to made that locally as wrote in documentations. But what if I want to distribute it via remote repository. How to do that? And is it possible to do taht without have a link to target application podfile inside library. It looks weird to have it here, especially in case I have no knowledge about who will use ny project.
    👀 1
    s
    y
    k
    • 4
    • 10
  • l

    Liliia

    10/05/2020, 2:09 PM
    Just crossposting here great news from KMM plugin: now we have a compatibility with Xcode 12 (iOS 14) on Android Studios 4.1 and 4.2. The update is also compatible with Xcode 11.3.1, as well as both Kotlin 1.4.10 and 1.4.20-M1. Looking forward to hear your feedback! 🙂
    👍 7
    🍎 2
    👏 6
    🎉 17
    💪 3
    t
    • 2
    • 1
  • r

    rsetkus

    10/05/2020, 3:35 PM
    Hi there. Just created an empty Kotlin Multiplatform Mobile library project and there is no gradlew or gradlew.bat even though 'Use Gradle wrapper' option selected. Is it normal? Also, I can see that gradle->wrapper was created.
    a
    k
    s
    • 4
    • 12
  • j

    Justin

    10/05/2020, 7:09 PM
    Has anyone built (or seen) a Kotlin Multiplatform library for compressing data? I need to compress and decompress strings on iOS and JVM. Both of those platforms seem to have their own GZIP implementations, but if someone has already created something like this, I'd be inclined to check it out before writing it myself.
    m
    r
    • 3
    • 7
  • d

    dambakk

    10/06/2020, 9:06 AM
    Are there any secure storage solutions for KMP? Doesn’t look like https://github.com/netguru/Kissme is maintained anymore.
    e
    • 2
    • 2
  • m

    mike.holler

    10/06/2020, 2:35 PM
    I'm new to Kotlin Multiplatform. Is there a good place to find multi-platform compatible libraries? Some wiki or community-curated list? I know about the official kotlinx projects, but I've had a hard time discovering libraries and tools available in the ecosystem outside of the official set.
    s
    a
    +3
    • 6
    • 17
  • m

    Maurice Jouvet

    10/06/2020, 8:20 PM
    Does anyone as already had an issue with sqldelight encode with adapter? I'm trying to serialize a simple object, it's working fine on android, but crashes on ios....
    @Serializable
    data class AccessModel(
        val isAccessible: Boolean = false,
        val conditions: List<ConditionModel>? = null
    )
    
    @Serializable
    data class ConditionModel(
        val id: Int,
        val value: List<String>? = null,
        val min: Float? = null,
        val max: Float? = null
    )
    It's crashing here:
    bindString(1, visibility?.let { database.FieldAdapter.accessModelAdapter.encode(it) })
    fun accessModelToString(item: AccessModel): String = Json.encodeToString(AccessModel.serializer(), item)
    val accessModelAdapter = object : ColumnAdapter<AccessModel, String> {
        override fun encode(value: AccessModel): String = SharedJSONConverter.accessModelToString(value)
    }
    Here the object that's crashing.
    {"conditions":[{"id":321,"value":["40"]}]}
    j
    • 2
    • 1
  • m

    Mathias Egekvist

    10/07/2020, 6:16 AM
    Hi! 👋 I'm currently trying to implement Ktor at my company, but I get a really weird error and I really don't know how to debug it. I was hoping someone here might have experienced the same or had any ideas 🙏 Full description on YouTrack
    g
    m
    • 3
    • 7
  • t

    Tobi

    10/07/2020, 3:46 PM
    Hey folks, I am porting an android library using
    ktor
    &
    kotlinx.serialization
    to a multiplatform library, but I am not sure which version of the multiplatform dependencies I should use. The android consumer of that library uses Kotlin
    1.3.72
    and I can't change that to
    1.4.x
    , yet. My android library uses ktor
    1.3.1
    and kotlinx.serialization
    0.20.0
    , but if I apply those versions to the multiplatform dependencies, I am running into an Kotlin/Native error:
    e: Could not find "/Users/X/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iosx64/1.3.1/df889ad1b8cc9fc91850d7d320b61e95597b1ce7/ktor-client-serialization.klib" in [/Users/X/Documents/repos/multiplatform-graph, /Users/X/.konan/klib, /Users/X/.konan/kotlin-native-macos-1.3.70/klib/common, /Users/X/.konan/kotlin-native-macos-1.3.70/klib/platform/ios_x64].
    Thanks in advance!
    l
    a
    • 3
    • 14
  • e

    edenman

    10/07/2020, 6:31 PM
    I’ve got a “resources” abstraction in my KMP library that uses expect/actual declarations to do the actual work of “get the localized string” and “build a color value from HSL/RGB” etc. Works pretty well. I’m trying to add some unit tests for this code and running into the limitation of expect/actual (that you can’t swap it out for a dummy impl in tests). What do other people do for this sort of thing? Use an interface instead?
    k
    • 2
    • 3
  • k

    Kavita

    10/07/2020, 7:25 PM
    Hello everyone, I just have started exploring Kotlin multiplatform and created the Hello World! project. I can run the Android project on emulator but I don't see the option to run the iOS app. Even iOS simulator option is also not visible. I must have missed something. How to run the iOS app in Kotlin Multiplatform project? Can someone please help me to solve this query?
    k
    l
    k
    • 4
    • 45
  • m

    mike.holler

    10/07/2020, 8:13 PM
    Anyone have any pointers for testing suspend functions in commonTest? I've tried depending on
    kotlinx-coroutines-test
    to help me with this, but unfortunately I ended up getting an error.
    val commonMain by getting {
        dependencies {
            implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
            implementation("io.ktor:ktor-client-core:1.4.0")
        }
    }
    val commonTest by getting {
        dependencies {
            implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9")
            implementation(kotlin("test-common"))
            implementation(kotlin("test-annotations-common"))
        }
    }
    Error:
    Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9.
    Required by:
        project :
    Caused by: org.gradle.internal.component.NoMatchingConfigurationSelectionException: No matching variant of org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9 was found. The consumer was configured to find a usage of 'kotlin-runtime' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js', attribute 'org.jetbrains.kotlin.js.compiler' with value 'legacy' but:
      - Variant 'apiElements' capability org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9:
          - Incompatible because this component declares an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a usage of 'kotlin-runtime' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js'
          - Other compatible attribute:
              - Doesn't say anything about org.jetbrains.kotlin.js.compiler (required 'legacy')
      - Variant 'runtimeElements' capability org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9 declares a runtime of a component:
          - Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js'
          - Other compatible attribute:
              - Doesn't say anything about org.jetbrains.kotlin.js.compiler (required 'legacy')
    t
    • 2
    • 14
  • b

    Big Chungus

    10/07/2020, 8:57 PM
    message has been deleted
    m
    • 2
    • 4
  • d

    dambakk

    10/08/2020, 8:47 AM
    @kpgalligan, I noticed the comment in the KaMPKit project saying
    // Revert to just ios() when gradle plugin can properly resolve it
    for adding the ios source set. Applying your “workaround” fixed my unresolved reference issues in iosMain. Do you know when the plugin will be fixed, or a ticket for the plugin I can follow the progress?
    👍 1
    s
    k
    r
    • 4
    • 9
  • g

    Grzegorz Sagadyn

    10/08/2020, 9:15 AM
    Hi, I’m trying to call a kotlin code from ios non main thread and I’m getting the following error:
    ########### make call
    first
    second
    Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared AsyncCalc.$makeCall$lambda-0$FUNCTION_REFERENCE$0@9d0328 from other thread
    Kotlin Code:
    interface ApiCall {
        fun get(url: String, success: (String) -> Unit)
    }
    
    class AsyncCalc(private val apiCall: ApiCall) {
    
        fun makeCall() {
            apiCall.freeze()
            println("########### make call")
            apiCall.get("<http://www.example.com|www.example.com>") {
                println("########### $it")
            }.freeze()
        }
    }
    iOS impl:
    let queue = DispatchQueue(label: "com.test.queue")
    
    class ApiCalcImpl: ApiCall {
        func get(url: String, success: @escaping (String) -> Void) {
            print("first")
            queue.async {
                print("second")
                success("hello")
                print("third")
            }
        }
    }
    
    @main
    internal class AppDelegate: UIResponder, UIApplicationDelegate {
        let test = ApiCalcImpl()
    
        internal func application(
            _ application: UIApplication,
            didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
        ) -> Bool {
            AsyncCalc(apiCall: test).makeCall()
    
            return true
        }
    ...
    k
    • 2
    • 4
  • m

    Max

    10/08/2020, 1:03 PM
    I created a multiplatform app using the Full-stack Web Application template and want to dockerize it. Using Jib to create the Docker Image. It works fine for the Jvm parts but i dont get the .js file provided by the jsBrowserProductionWebpack task in my docker container. Anyone have any experience using jib with multiplatform?
    • 1
    • 2
  • m

    Marc Knaup

    10/08/2020, 4:38 PM
    Does anybody know how to get around this error?
    Initialization script ‘/private/var/folders/wp/jsq85rms0tsf2h7x_9kqfztr0000gn/T/MigrationKt_main__.gradle’ line: 27
    > Could not create task ‘:raptor:MigrationKt.main()’.
    > Could not get unknown property ‘sourceSets’ for project ‘:raptor’ of type org.gradle.api.Project.
    It’s when I run a
    main
    function from IDE. The project is a JVM project and depends on a multi-module multiplatform library (
    raptor
    ) which is an included Gradle build. Here’s the offending code generated by the IDE (the
    else
    branch):
    • 1
    • 2
  • m

    mike.holler

    10/08/2020, 9:52 PM
    In Kotlin JVM,
    .kt
    and
    .java
    files can exist side-by-side in the file system and you can access Kotlin functions from the Java file and vice versa. Are there any examples of doing that with JS? I'm talking within the same source set and file structure. I can't seem to figure it out.
    b
    j
    • 3
    • 13
  • m

    mike.holler

    10/09/2020, 1:39 PM
    I have a Kotlin Multiplatform library I'm trying to use from
    .js
    as a npm package. I can call normal functions just fine in JS, but
    suspend
    functions are a bit of an enigma from the
    .js
    side. I know I can create a wrapper in
    jsMain
    but I'd rather not manually do that for every suspend function. Is there any way to call a suspend function in JS and get a promise back (even if it requires a little helper function?) Here is a modified version of the Base64 library example to show what I'm trying to do. Kotlin Implementation
    interface Base64Encoder {
        @JsName("encode")
        fun encode(src: ByteArray): ByteArray
    
        @JsName("encodeToString")
        fun encodeToString(src: ByteArray): String {
            return encode(src).let { encoded ->
                buildString(encoded.size) {
                    encoded.forEach { append(it.toChar()) }
                }
            }
        }
    
        suspend fun downloadAndEncodeToString(url: String): String {
            return HttpClient().use {
                it.get<HttpResponse>(url = Url(url)).readText()
            }
        }
    }
    JS Usage (see image below)
    a
    • 2
    • 1
  • m

    Mustafa Ozhan

    10/09/2020, 2:54 PM
    Hello guys, I have a question, I created project with standart Android Studio KMM plugin. And then I added also my
    backend
    module into project as
    jvm
    target but surprisingly backend Module is not seeing
    commonJvm
    rather it sees
    commonAndroid
    expected values. Also I can not reach the class in
    commonMain
    from
    backend
    module. Did anyone had similar issue ? You can see the gradle.kts files in thread
    a
    s
    j
    • 4
    • 26
  • m

    Mikołaj Kąkol

    10/09/2020, 4:27 PM
    Hi, it seams that
    MutableStateFlow
    is not suitable for MPP when multi-threading, since it will be frozen and crash. Any good replacement or knowledge if it will work eventually? My case is that I would like on Native (iOS) watch for value changes and be able to notify kotlin code when Native would like to change value. It's would be okay to have two fields, one for reading and second for writing.
    t
    • 2
    • 2
  • b

    Brady Aiello

    10/10/2020, 9:29 PM
    For iOS KMP, are the generated methods shorter when invoking from Swift than from Obj-C?
    a
    • 2
    • 2
  • c

    Christian Sousa

    10/12/2020, 4:09 PM
    Hey guys, I’m investigating for the company I work for if we can upgrade to Kotlin 1.4 (we are using Kotlin 1.3.70 right now), but when updating for 1.4.10 or even 1.4.20-M1 I get the following on iOS (we are building a multiplatform project):
    Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    Does anyone knows what might be causing this? This is not happening on our current implementation using 1.3.70, so it might be something that might’ve changed in this new release. Any help would be really nice! Thanks in advance!
    a
    • 2
    • 4
  • g

    georg

    10/12/2020, 6:10 PM
    Hey everyone, I created a Gradle plugin that generates an XCFramework and a Package.swift file so that you can distribute your multiplatform library as a binary target for Apple platforms. You can find all the details on Github. Please give it a shot and let me know what you think. Looking forward for your feedback. https://github.com/ge-org/multiplatform-swiftpackage
    🎉 7
    🆒 6
    🙌 1
    k
    t
    • 3
    • 4
  • s

    Sebouh Aguehian

    10/13/2020, 8:10 AM
    I’m testing the just released Android Studio KMM plugin (0.1.3-release-54-Studio4.0). The announcement article says:
    For both the application and tests you can set breakpoints and debug your code on iOS.
    I created a new project and added a single iOS test in the shared module. Stopping on breakpoints isn’t working.
    import kotlin.test.Test
    import kotlin.test.assertTrue
    
    class IosTest {
        @Test
        fun test() {
            assertTrue(false) // breakpoint here
        }
    }
    k
    k
    • 3
    • 6
  • p

    peekandpoke

    10/13/2020, 8:53 AM
    Hi there! I have a problem that I have spent mutliple hours on now, but I could not find a solution. So we have this situation: We are using a multiplatform library, which is published through bintray. On my machine everything works fine. On my colleagues machine it does not. One curious thing is the following. On my machine i can see in IntelliJ that all dependencies are loaded, especially the "commonmp-metadata" ... Please compare the two screenshot I attached. On my colleagues machine this some does not seem to be fetched properly and therefore things do not compile. He sees lot's of errors of unresolved symbols in the IDE while I do not. Basically non of the packages and classses from the library are recognized. What is even more strange is that "./gradlew build" does work for him, but "./gradlew assemble" does not. When running assemble the failing gradle task is "compileKotlinMetadata" on the subproject using the multiplatform lib. We have tried to see what is different in the setups of our systems. Java version 1..8.0_265 is the same. Nodejs 10.19.0 is the same. Npm 6.14.4 is the same. The only difference we can spot is that I am running Pop!Os and he runs Ubuntu. Another colleague with Ubuntu has the same issue by the way. Sooooo... long text. Does anyone have an idea what to look for? Thanks a lot.
    ✔️ 2
    m
    • 2
    • 15
Powered by Linen
Title
p

peekandpoke

10/13/2020, 8:53 AM
Hi there! I have a problem that I have spent mutliple hours on now, but I could not find a solution. So we have this situation: We are using a multiplatform library, which is published through bintray. On my machine everything works fine. On my colleagues machine it does not. One curious thing is the following. On my machine i can see in IntelliJ that all dependencies are loaded, especially the "commonmp-metadata" ... Please compare the two screenshot I attached. On my colleagues machine this some does not seem to be fetched properly and therefore things do not compile. He sees lot's of errors of unresolved symbols in the IDE while I do not. Basically non of the packages and classses from the library are recognized. What is even more strange is that "./gradlew build" does work for him, but "./gradlew assemble" does not. When running assemble the failing gradle task is "compileKotlinMetadata" on the subproject using the multiplatform lib. We have tried to see what is different in the setups of our systems. Java version 1..8.0_265 is the same. Nodejs 10.19.0 is the same. Npm 6.14.4 is the same. The only difference we can spot is that I am running Pop!Os and he runs Ubuntu. Another colleague with Ubuntu has the same issue by the way. Sooooo... long text. Does anyone have an idea what to look for? Thanks a lot.
✔️ 2
m

mbonnin

10/13/2020, 8:56 AM
What version of gradle are you using? It might be worth check your
~/.gradle/gradle.properties
to see if they're matching
p

peekandpoke

10/13/2020, 8:56 AM
Oh right we use Gradle 6.6.1
./gradlew --version show the exact same output except for the kernel version of Linux
👍 1
./gradlew --version

------------------------------------------------------------
Gradle 6.6.1
------------------------------------------------------------

Build time:   2020-08-25 16:29:12 UTC
Revision:     f2d1fb54a951d8b11d25748e4711bec8d128d7e3

Kotlin:       1.3.72
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM:          1.8.0_265 (Oracle Corporation 25.265-b01)
OS:           Linux 5.4.0-7642-generic amd64
m

mbonnin

10/13/2020, 8:59 AM
I was maybe thinking about gradle metadata support which was only enabled by default with Gradle 6+ but 6.6.1 should work fine
It's still worth checking the
gradle.properties
p

peekandpoke

10/13/2020, 9:00 AM
In the home directory you mean?
m

mbonnin

10/13/2020, 9:01 AM
Yes
p

peekandpoke

10/13/2020, 9:01 AM
We did... on my machine there is not such file present. On the other one the file is empty.
m

mbonnin

10/13/2020, 9:02 AM
Then it's something else...
delete all caches and retry?
Or maybe the network configuration makes it so that the artifacts are resolved from different locations?
p

peekandpoke

10/13/2020, 9:03 AM
We did multiple times. Stopped gradle daemons. Disabled incremental build. Nothing.
Ok issue is fixed... What happened? The mpp library we use is published from my machine and so it landed right away in my .m2 cache. There also was a problem with the setup of how the lib was published to bintray. Nevertheless using the library kept working on my machine, but not on the machine of my colleagues. More specific the mistake was the following. In the build.gradle.kts for the library we had this piece of code:
afterEvaluate {

    project.publishing.publications.filterIsInstance<MavenPublication>().forEach {

        it.groupId = group as String

        if (it.name.contains("kotlinMultiplaform")) {
            it.artifactId = project.name
        } else {
            it.artifactId = "${project.name}-${it.name}"
        }
    }
}
The wrong piece here is to rename the
kotlinMultiplatform
. What we have now is to treat the
metadata
like this:
afterEvaluate {

    project.publishing.publications.filterIsInstance<MavenPublication>().forEach {

        it.groupId = group as String

        if (it.name.contains("metadata")) {
            it.artifactId = project.name
        } else {
            it.artifactId = "${project.name}-${it.name}"
        }
    }
}
And now finally everything is fine.
m

mbonnin

10/13/2020, 1:34 PM
Aaaaarg, yes mavenLocal() ! Good find!
View count: 10