https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

jean

12/04/2023, 8:58 AM
I’m getting this error when I use the gradle command
assembleXCFramework
Copy code
error: the path does not point to a valid framework: /Users/jeantuffier/Repos/Entur/Tavla/CommonTavla/build/common_tavlaXCFrameworkTemp/fatframework/debug/iosSimulator/common_tavla.framework

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':assembleCommon-tavlaDebugXCFramework'.
> Process 'command 'xcodebuild'' finished with non-zero exit value 70
any ideas how I can fix that?
The documentation says there are 3 gradle commands related to XC framework •
assembleXCFramework
assembleDebugXCFramework
assembleReleaseXCFramework
But I get
Task 'assembleDebugXCFramework' not found in root project 'common-tavla'.
a

Andrei Salavei

12/04/2023, 9:30 AM
1. Just guessing: Looks like you are trying to assemble XCFramework without XCode properly configured on your machine. Please make sure you are using latest XCode version and all required iOS simulators are installed (usually it happends after the first launch) https://stackoverflow.com/questions/54515763/cant-build-project-on-ios-error-code-70-how-to-fix-it 2. try to run
./gradlew tasks
to verify if task you mentioned exists
j

jean

12/04/2023, 11:34 AM
1. I have XCode up and running, no issues with using the simulator (iphone 15 pro) 2. I found the task but they have a different naming pattern :
assemble[PROJECT_NAME]DebugXCFramework
My project is actually a multiplatform library, so I’m not sure why
xcodebuild
is used. And running
xcodebuild
from the xcode project consuming the library, I don’t get any error
Running
assembleXCFramework
from the command line with
--stacktrace
gave me this
Copy code
w: Name of XCFramework 'common-tavla' differs from inner frameworks name 'CommonTavla'! Framework renaming is not supported yet

error: the path does not point to a valid framework: /Users/jeantuffier/Repos/Entur/Tavla/CommonTavla/build/common_tavlaXCFrameworkTemp/fatframework/debug/iosSimulator/common_tavla.framework
It seems like the error came from the difference between the root name of the project and the name used for the ios binaries. By naming the root project
CommonTavla
I don’t get the error anymore
👍 1
d

Darshan Nair

02/14/2024, 4:01 PM
Hi @jean - I am also facing similar issue on generating XCFramework using KMP gradle command
./gradlew assembleXCFramework
Name of XCFramework 'kmp-shared' differs from inner frameworks name 'shared'! Framework renaming is not supported yet
error: the path does not point to a valid framework: /Users/danair/Desktop/KotlinMultiPlatform/my-kotlin/libraries/kmp-libraries/kmp-shared/build/kmp_sharedXCFrameworkTemp/fatframework/debug/iosSimulator/kmp_shared.framework
Could you help me how you solved this issue? I tried multiple ways but no lucj.
I have a KMP module
kmp-shared
in existing android kotlin project and am trying to generate XCFramework from here. Below is my build.gradle:
Copy code
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework

plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.androidLibrary)
}

kotlin {
    androidTarget {
        compilations.all {
            kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    }

    val xcf = XCFramework("kmp-shared")
    val iosTargets = listOf(iosX64(), iosArm64(), iosSimulatorArm64())
    iosTargets.forEach {
        it.binaries.framework {
            baseName = "shared"
            xcf.add(this)
        }
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
                ...
            }
        }
    }
}

android {
    namespace = "com.wbd.beam.kmp"
    compileSdk = 34
    defaultConfig {
        minSdk = 21
    }
}
j

jean

02/15/2024, 7:31 AM
Hei! I manually changed the name of the root project in the settings.grafle file if I remember correctly. You could eventually change the name of the exported binary in the iOS block so both module and binary matches
d

Darshan Nair

02/16/2024, 9:52 AM
Thanks. I got it fixed by running the
assembleSharedXCFramework
assemble command. Seems the default assemble command
assembleXCFramework
was using the module name which is different then my XC baseName.
8 Views