• chansek

    chansek

    7 months ago
    In my common module of KMM, I have this data class:
    data class UserRole(
        val entity: Entity,                            
        val role: Role,
        val entityId: String
    ) {
    
        fun isAdmin() = role == Role.ADMIN
    }
    When I do serialize it, I get
    admin
    as a property. How can I avoid that?
    chansek
    Grégory Lureau
    3 replies
    Copy to Clipboard
  • t

    Travis Reitter

    7 months ago
    what's the recommended acronym? I've seen both "KMP" and "KMM"
    t
    i
    +4
    9 replies
    Copy to Clipboard
  • j

    Jeff Lockhart

    7 months ago
    After upgrading to Android Studio Bumblebee, I'm now getting an error during the gradle sync:
    Execution failed for task ':shared:podGenIOS'.
    > 'pod gen' command failed with an exception:
       Cannot run program "pod" (in directory "/.../shared/build/cocoapods/synthetic/IOS"): error=2, No such file or directory
              
              Possible reason: CocoaPods is not installed
              Please check that CocoaPods v1.10 or above and cocoapods-generate plugin are installed.
              
              To check CocoaPods version type 'pod --version' in the terminal
              
              To install CocoaPods execute 'sudo gem install cocoapods'
              To install cocoapod-generate execute 'sudo gem install cocoapods-generate'
    cocoapods
    and
    cocoapods-generate
    are both installed and work when executed from the terminal. The build worked before the Android Studio upgrade as well.
    ./gradlew :shared:podGenIOS
    also works on the command line and after completion, the AS gradle sync completes successfully, until it fails again later. Has anyone else experienced anything like this or have any idea what the issue might be?
    j
    louiscad
    6 replies
    Copy to Clipboard
  • Rohan Maity

    Rohan Maity

    7 months ago
    Hello, is there any Dependency Injection library which could be used for Multi-platform project target android, Web (JS), iOS and desktop ?
    Rohan Maity
    Mustafa Ozhan
    +5
    22 replies
    Copy to Clipboard
  • jean

    jean

    7 months ago
    I’m trying to create a new kmm project using cocoapods in android studio but I keep getting this warning
    Dependency on pods requires cocoapods-generate plugin to be installed.
    If you plan to add dependencies on third party pods, don’t forget to install it by executing ‘gem install cocoapods-generate’ in terminal.
    and this error
    Execution failed for task ':shared:podInstall'.
    > 'pod install' command failed with code 1.
      Error message:
      
             Please, check that podfile contains following lines in header:
             source '<https://cdn.cocoapods.org>'
      
              Please, check that each target depended on shared contains following dependencies:
    I did follow this 7-steps https://youtrack.jetbrains.com/issue/KT-49418#focus=Comments-27-5429773.0-0 but it still doesn’t work. I had to adjust it a bit since I have a Mac/Intel computer. I added this to my
    ~/.zshrc
    export LANG=en_US.UTF-8
    export PATH="/usr/local/opt/ruby@2.7/bin:/usr/local/lib/ruby/gems/2.7.0/bin:$PATH"
    I did try both
    sudo gem install -n /usr/local/bin cocoapods
    sudo gem install -n /usr/local/bin cocoapods-generate
    and
    sudo gem install cocoapods
    sudo gem install cocoapods-generate
    Anything else I should try?
    jean
    1 replies
    Copy to Clipboard
  • Yevhen Railian

    Yevhen Railian

    7 months ago
    Hello everyone. All examples that i saw with shared module with KMM were as a single project for both platforms. We have two different repositories on github for iOS and for Android. Is it possible to move shared module to the separate github repository and configure it with KMM plugin somehow to start using it with existing repositories without merging theme to one? I did not find it in the documentation. Thanks.
    Yevhen Railian
    Scott Kruse
    +2
    6 replies
    Copy to Clipboard
  • Nilay Dağdemir

    Nilay Dağdemir

    7 months ago
    Hello all, By default do kotlin 1.6.0 creates the shared framework for iOS with bitcode enabled or should I write the code below on the build gradle file?
    kotlin {
    iosArm64(*"myapp"*) {
    binaries {
    framework {
    embedBitcode(*"bitcode"*) // for release binaries.
    }
    }
    }
    }
    I searched but couldn’t find a clear answer about this subject. *I’m not using cocoapods
    Nilay Dağdemir
    Viacheslav Kormushkin
    +1
    8 replies
    Copy to Clipboard
  • Lukasz Kalnik

    Lukasz Kalnik

    7 months ago
    I use a shared ViewModel in an Android/iOS app. I inject some dependencies there with Koin. However when trying to write data to the
    apiConfigRepository
    dependency I get the exception mutation attempt of frozen ApiConfigurationRepositoryImpl@1edb608:
    class TVShowsSharedViewModelImpl(
        dispatcher: CoroutineDispatcher = Dispatchers.Main
    ) : TVShowsSharedViewModel,
        KoinComponent {
    
        val coroutineScope = CoroutineScope(dispatcher)
    
        val tmdbApi: TmdbApi by inject()
        val apiConfigRepository: ApiConfigurationRepository by inject()
    
        init {
            coroutineScope.launch {
                val apiConfig = tmdbApi.getConfiguration()
                with(apiConfigRepository) {
                    imageBaseUrl = apiConfig.images.baseUrl
                    updateBackdropSizes(apiConfig.images.backdropSizes)
                }
            }
        }
    }
    Lukasz Kalnik
    l
    2 replies
    Copy to Clipboard
  • ynsok

    ynsok

    7 months ago
    Hi 😄 I have a multiplatform project targeting Desktop and Android. I would like to use the library for navigation voyager, but unfortunately, I’m getting this error.
    Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
    Any suggestion how to solve it ?
    ynsok
    Big Chungus
    +1
    6 replies
    Copy to Clipboard
  • martmists

    martmists

    7 months ago
    I'm trying to test my multiplatform project but I'm getting
    e: /home/mart/git/command_parser/src/commonTest/kotlin/CommandTests.kt: (7, 15): Unresolved reference: test
    e: /home/mart/git/command_parser/src/commonTest/kotlin/CommandTests.kt: (8, 15): Unresolved reference: test
    e: /home/mart/git/command_parser/src/commonTest/kotlin/CommandTests.kt: (11, 6): Unresolved reference: Test
    e: /home/mart/git/command_parser/src/commonTest/kotlin/CommandTests.kt: (23, 13): Unresolved reference: assertTrue
    despite having this in my build.gradle.kts:
    val commonTest by getting {
                dependencies {
                    implementation("org.jetbrains.kotlin:kotlin-test-common:1.6.10")
                    implementation("org.jetbrains.kotlin:kotlin-test-annotations-common:1.6.10")
    
                    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
                    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0")
                }
            }
    and the code for testing is
    import com.martmists.commandparser.dispatch.Context
    import com.martmists.commandparser.dispatch.Dispatcher
    import com.martmists.commandparser.dsl.build
    import kotlinx.coroutines.Dispatchers
    import kotlinx.coroutines.*
    import kotlinx.coroutines.test.runTest
    import kotlin.test.Test
    import kotlin.test.assertTrue
    
    class CommandTests {
        @Test
        fun testNoArgs() = runTest {
            launch(Dispatchers.Main) {
                val dispatcher = Dispatcher<Context>()
                build(dispatcher) {
                    command("test") {
                        action {
                            println("test success")
                        }
                    }
                }
                val ctx = Context("test")
                assertTrue(dispatcher.dispatch(ctx))
            }
        }
    }
    martmists
    1 replies
    Copy to Clipboard