• h

    harry248

    6 months ago
    Anyone got a Kotlin Multiplatform to work with Sonarqube?
    h
    Javier
    6 replies
    Copy to Clipboard
  • s

    Sunil Kumar

    6 months ago
    Hi everyone, In Koltin multiplatform project, I have an object class in shared module in commonMain and i am trying to access and update some variables of that object class from native android and ios project, From android its working fine, but its showing this exception in ios project:
    Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen com.buildingengines.sharedmoduletenant.core.service.KmmServiceLocator@1518f08
    How to solve this problem, cant we access and update shared module object class variables from swift ios? any workaround for this, Guys Please help. i am stuck with this. I need singleton class in shared module and then inject some native android and ios dependencies into that class on app startup.
    s
    Landry Norris
    11 replies
    Copy to Clipboard
  • h

    humblehacker

    6 months ago
    What is the best IDE to use for KMM? The FAQ suggests Android Studio, while also saying that one can use Intellij Ultimate with some limitations. Android Studio works for the most part, but there's no support for Swift. I typically do most of my iOS dev in AppCode, and I was happy to find a KMM plugin for AppCode. However, opening the project created in Android Studio in AppCode with the KMM plugin installed resulted in a number of issues, such as the project requiring conversion to a KMM project, facets that cannot be loaded, and a lot of red in the Kotlin syntax highlighting. I also tried creating the project in AppCode, but after restarting AppCode and reloading the project, I got the same facets cannot be loaded error ("unknown face type" kotlin-language and android). [edit: I updated AppCode while composing this, and just needed to reinstall the KMM related plugins]. Most of these are probably just growing pains for KMM, and I can open tickets for these things, but as someone just getting started with KMM, which IDE should I stick with for the least amount of difficulty?
    h
    Big Chungus
    +4
    10 replies
    Copy to Clipboard
  • s

    Sebastien Leclerc Lavallee

    6 months ago
    Hello! I have an already present multiplatform project which I want to a ktor server module. I have a core multiplatform module like this:
    plugins {
      kotlin("multiplatform")
      kotlin("plugin.serialization")
    }
    
    version = "1.0.0"
    java.sourceCompatibility = JavaVersion.VERSION_1_8
    java.targetCompatibility = JavaVersion.VERSION_1_8
    
    kotlin {
      js(IR) {
        browser()
      }
    
      jvm()
    
      sourceSets {
        val commonMain by getting {
          dependencies {
            implementation(kotlin("stdlib-common"))
            implementation(Deps.kotlinxSerialization)
          }
        }
    
        val commonTest by getting {
          dependencies {
            api("org.jetbrains.kotlin:kotlin-test")
          }
        }
    
        val jvmMain by getting
        val jvmTest by getting
        val jsMain by getting
        val jsTest by getting
      }
    }
    And now I did add this new ktor module
    plugins {
      kotlin("jvm")
      kotlin("plugin.serialization")
      id("application")
    }
    version = "1.0.0"
    java.sourceCompatibility = JavaVersion.VERSION_1_8
    java.targetCompatibility = JavaVersion.VERSION_1_8
    
    dependencies {
      implementation(kotlin("stdlib"))
    
      implementation(project(":core"))
      implementation("io.ktor:ktor-server-core:1.6.1")
      implementation("io.ktor:ktor-server-netty:1.6.1")
      implementation("io.ktor:ktor-serialization:1.6.1")
      implementation("ch.qos.logback:logback-classic:1.2.6")
    }
    
    application {
      mainClass.set("ca.sebleclerc.api.ApplicationKt")
    }
    When I execute
    ./gradlew server:run
    I get this error:
    * What went wrong:
    Could not determine the dependencies of task ':server:run'.
    > Could not resolve all task dependencies for configuration ':server:runtimeClasspath'.
       > Could not resolve project :core.
         Required by:
             project :server
          > The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'. However we cannot choose between the following variants of project :core:
              - jvmRuntimeElements
              - ktlint
            All of them match the consumer attributes:
              - Variant 'jvmRuntimeElements' capability core:1.0.0 declares a runtime of a library, packaged as a jar, preferably optimized for standard JVMs, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
                  - Unmatched attributes:
                      - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                      - Doesn't say anything about its target Java version (required compatibility with Java 8)
    [... and so on]
    I understand it can’t match anything that is produced by my core module but I can’t find anything to make it work. I did tried a few things but nothing worked… Anybody have any clue? Hint? I am using Kotlin 1.6.20-M1 Thanks for the help 🙂
    s
    Sebastian Sellmair [JB]
    +1
    15 replies
    Copy to Clipboard
  • c

    cafonsomota

    6 months ago
    hello all! I’ve been trying to understand this issue: • when trying to run the iOS app from Android Studio the simulator opens but the app doesn’t install if you go to run configurations there’s an error there saying “Error: Selected scheme “iosApp” does not support “iphonesimulator”“. while trying to debug this I’ve noticed that this happens due to cocoapods; I’ve tried the pod like
    SwiftLint
    and everything works, but if I use other ones like
    AlertToast
    or
    SDWebImageSwiftUI
    it doesn’t work. any ideia why? I’m able to run the app both from xcode and to install it in a real device
    c
    m
    +1
    6 replies
    Copy to Clipboard
  • v

    Vivek Modi

    6 months ago
    Hey guys, I am trying this kmm-basic-sample from the kotlin sample. I am trying to Add and configure Kotlin CocoaPods Gradle plugin from the offiical doc. I am trying to add this line
    kotlin("native.cocoapods") version "1.6.10"
    and I am getting-this weird issue. Can someone help on this
    org.gradle.internal.exceptions.LocationAwareException: Build file '/Users/vmodi/Downloads/kmm-basic-sample-master/shared/build.gradle.kts' line: 1
    v
    e
    5 replies
    Copy to Clipboard
  • c

    Conrad Kramer

    6 months ago
    Is it possible to use expect and actual with a static function like
    SomeType.fromByteArray(data: ByteArray)
    ? Because I know you can’t expect companion objects
    c
    Big Chungus
    2 replies
    Copy to Clipboard
  • e

    eygraber

    6 months ago
    Will shared code in an expect class ever be supported? Or will I always need a concrete "shared" superclass?
    expect abstract class Foo {
      internal fun doAFoo() = println("Foo")
    }
    
    vs
    
    abstract class SharedFoo {
      internal fun doAFoo() = println("Foo")
    }
    
    expect abstract class Foo : SharedFoo()
    e
    1 replies
    Copy to Clipboard
  • vishal G

    vishal G

    6 months ago
    Can someone share an example project used with russolf multiplatform settings in a KMM project
    vishal G
    Andrey Chernov
    +4
    10 replies
    Copy to Clipboard
  • Aditya Kurkure

    Aditya Kurkure

    6 months ago
    Can I pass a function
    (UIBackgroundFetchResult) -> void
    from swift to Kotlin? Currently the method I have written in kotlin expects a
    (UIKUIBackgroundFetchResult) -> void
    when called from swift.
    Aditya Kurkure
    s
    4 replies
    Copy to Clipboard