icerockdev / moko-mvvm

Model-View-ViewModel architecture components for mobile (android & ios) Kotlin Multiplatform development

Home Page:https://moko.icerock.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Error : Execution failed for task ':MultiPlatformLibrary:linkPodDebugFrameworkIosSimulatorArm64'.

RageshAntony opened this issue · comments

I am getting build error , when building for iOS Sim in Xcode

Error : full stacktrace: https://gist.github.com/RageshAntony/fb67ef278eb4f1394e9f7a2a1f319127


> Task :MultiPlatformLibrary:compileKotlinIosSimulatorArm64 UP-TO-DATE
> Task :MultiPlatformLibrary:linkPodDebugFrameworkIosSimulatorArm64 FAILED
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':MultiPlatformLibrary:linkPodDebugFrameworkIosSimulatorArm64'.
> 'org.gradle.api.provider.Provider org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink.getIntermediateLibrary()'

shared Gradle

plugins {
    kotlin("multiplatform")
    kotlin("native.cocoapods")
    id("com.android.library")
    id("dev.icerock.moko.kswift")
}

version = "1.0"
val mokoMvvmVersion = "0.13.0"

kotlin {
    android()
    iosX64()
    iosArm64()
    iosSimulatorArm64()

    cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        ios.deploymentTarget = "14.1"
        podfile = project.file("../iosFullApp/Podfile")
        framework {
            baseName = "MultiPlatformLibrary"
            export("dev.icerock.moko:mvvm-core:$mokoMvvmVersion")
            export("dev.icerock.moko:mvvm-flow:$mokoMvvmVersion")
            export("dev.icerock.moko:mvvm-livedata:$mokoMvvmVersion")
            export("dev.icerock.moko:mvvm-livedata-resources:$mokoMvvmVersion")
            export("dev.icerock.moko:mvvm-state:$mokoMvvmVersion")
        }
    }
    
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation ("com.badoo.reaktive:reaktive:1.2.2")
                implementation ("com.badoo.reaktive:reaktive-annotations:1.2.2")
                api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1-native-mt")

                api("dev.icerock.moko:mvvm-core:$mokoMvvmVersion")
                api("dev.icerock.moko:mvvm-flow:$mokoMvvmVersion")
                api("dev.icerock.moko:mvvm-livedata:$mokoMvvmVersion") // api mvvm-core, LiveData and extensions
                api("dev.icerock.moko:mvvm-state:$mokoMvvmVersion") // api mvvm-livedata, ResourceState class and extensions
                api("dev.icerock.moko:mvvm-livedata-resources:$mokoMvvmVersion") // api mvvm-core, moko-resources, extensions for LiveData with moko-resources

            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting {
            dependencies {
                api("dev.icerock.moko:mvvm-flow-compose:$mokoMvvmVersion")
            }
        }
        val androidTest by getting
        val iosX64Main by getting
        val iosArm64Main by getting
        val iosSimulatorArm64Main by getting
        val iosMain by creating {
            dependsOn(commonMain)
            iosX64Main.dependsOn(this)
            iosArm64Main.dependsOn(this)
            iosSimulatorArm64Main.dependsOn(this)
        }
        val iosX64Test by getting
        val iosArm64Test by getting
        val iosSimulatorArm64Test by getting
        val iosTest by creating {
            dependsOn(commonTest)
            iosX64Test.dependsOn(this)
            iosArm64Test.dependsOn(this)
            iosSimulatorArm64Test.dependsOn(this)
        }
    }
}

android {
    compileSdk = 32
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdk = 21
        targetSdk = 32
    }
}

kswift {
    install(dev.icerock.moko.kswift.plugin.feature.SealedToSwiftEnumFeature)
    install(dev.icerock.moko.kswift.plugin.feature.PlatformExtensionFunctionsFeature)

}

dependencies {
    commonMainApi("dev.icerock.moko:kswift-runtime:0.5.0") // if you want use annotations
}


project gradle

buildscript {
    val compose_version by extra("1.3.0-alpha02")

    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
        classpath("com.android.tools.build:gradle:7.2.1")
        classpath("dev.icerock.moko:kswift-gradle-plugin:0.5.0")

    }
}

allprojects {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

tasks.register("clean", Delete::class) {
    delete(rootProject.buildDir)
}

podfile

target 'iosFullApp' do
  use_frameworks!
  platform :ios, '14.1'
  pod 'MultiPlatformLibrary', :path => '../MultiPlatformLibrary'
  pod 'mokoMvvmFlowSwiftUI', :podspec => 'https://raw.githubusercontent.com/icerockdev/moko-mvvm/release/0.13.0/mokoMvvmFlowSwiftUI.podspec'
end

Please help me

your problem caused by this - icerockdev/moko-kswift#53

your problem caused by this - icerockdev/moko-kswift#53

Okay Thanks @Alex009 . I fixed it by changing kotlin version to 1.6.10 and build was success

But when running in iOS Sim , I am getting this error in log . Why ?

dyld[1887]: Library not loaded: @rpath/MultiPlatformLibrary.framework/MultiPlatformLibrary
Referenced from: /Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/mokoMvvmFlowSwiftUI.framework/mokoMvvmFlowSwiftUI

Reason: tried: '/Users/rageshantonyd/Library/Developer/Xcode/DerivedData/iosFullApp-gjaqquyxuygqjaaqquyrltywrrsz/Build/Products/Debug-iphonesimulator/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/mokoMvvmFlowSwiftUI.framework/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file), '/usr/lib/swift/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file), '/usr/lib/swift/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file)

Library not loaded: @rpath/MultiPlatformLibrary.framework/MultiPlatformLibrary
Referenced from: /Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/mokoMvvmFlowSwiftUI.framework/mokoMvvmFlowSwiftUI
Reason: tried: '/Users/rageshantonyd/Library/Developer/Xcode/DerivedData/iosFullApp-gjaqquyxuygqjaaqquyrltywrrsz/Build/Products/Debug-iphonesimulator/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Frameworks/MultiPlatformLibrary.framework/MultiPlatformLibrary' (no such file),

'/Users/rageshantonyd/Library/Developer/CoreSimulator/Devices/B908D4B5-865A-4743-8493-18D9A357841A/data/Containers/Bundle/Application/6A370589-A088-4D59-8C45-F2340B7CB112/iosFullApp.app/Framew
(lldb)

======

Also getting Warning after building

(arm64) could not find object file symbol for symbol _kfun:dev.icerock.moko.mvvm.dispatcher.EventsDispatcher#(){}

(arm64) could not find object file symbol for symbol _kfun:dev.icerock.moko.mvvm.dispatcher.EventsDispatcher.#internal

(arm64) could not find object file symbol for symbol _kfun:dev.icerock.moko.mvvm.dispatcher.EventsDispatcher.#internal

(arm64) could not find object file symbol for symbol _kfun:dev.icerock.moko.mvvm.dispatcher.EventsDispatcher.#internal

(arm64) could not find object file symbol for symbol _kfun:dev.icerock.moko.mvvm.dispatcher.EventsDispatcher#(){}1:0?

(arm64) could not find object file symbol for symbol _kfun:dev.icerock.moko.mvvm.dispatcher.EventsDispatcher#(1:0?){}
......
.....

Please help me

@RageshAntony in cocoapods.framework block you should set isStatic = false to use mokoMvvmFlowSwiftUI addition.
check here - https://github.com/Alex009/moko-mvvm-compose-swiftui/blob/master/shared/build.gradle.kts#L25

@RageshAntony in cocoapods.framework block you should set isStatic = false to use mokoMvvmFlowSwiftUI addition. check here - https://github.com/Alex009/moko-mvvm-compose-swiftui/blob/master/shared/build.gradle.kts#L25

Thanks . Running now @Alex009

But still the KS files not generated by KSWift for sealed interfaces

package com.example.fullapp

import dev.icerock.moko.kswift.KSwiftInclude

@KSwiftInclude
public sealed interface LoginAction {
public object LoginSuccess : LoginAction ()

}

Can't find LoginActionKs generated class.