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

Nicolas Verinaud

06/27/2022, 7:41 PM
[SOLVED ] I have a strange bug when building the shared xcframework. Everything works fine on my Mac Intel but it fails on a M1 Mac with the error
Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'.
. Is there a cache or something on the M1 Mac ? It could be related to the kotlin version used but how can I verify ? Is this task unavailable on M1 Macs ?
plus1 2
a

Alex Acosta

06/27/2022, 7:53 PM
M1 is supported, you have to also include
iosSimulatorArm64()
target in your build.gradle file.
Copy code
...
ios()
iosSimulatorArm64()
macosX64()
...
Also, are you using SPM?
n

Nicolas Verinaud

06/27/2022, 8:09 PM
Ok I did it, but now I have a load of
could not resolve ...
I’m not using SPM
a

Alex Acosta

06/27/2022, 8:10 PM
try adding this as well:
Copy code
val iosMain by getting { ... }
val iosSimulatorArm64Main by getting {
    dependsOn(iosMain)
}
val iosSimulatorArm64Test by getting {
    dependsOn(iosTest)
}
n

Nicolas Verinaud

06/27/2022, 8:11 PM
Even more
could not resolve ...
😅
Maybe should I update some dependencies ?
a

Alex Acosta

06/27/2022, 8:13 PM
some dependencies might not have the iosSimulatorArm64 support
n

Nicolas Verinaud

06/27/2022, 8:14 PM
Okay, I updated
benasher44:uuid
and it disappeared from
could not resolve
issues
a

Alex Acosta

06/27/2022, 8:16 PM
O do see the support, double check you are using the latest version: https://mvnrepository.com/artifact/com.benasher44/uuid-iossimulatorarm64
n

Nicolas Verinaud

06/27/2022, 8:22 PM
Okay, I updated every dependencies, gradle sync works
Building still fails with task not being found 😞
a

Alex Acosta

06/27/2022, 8:29 PM
can you show the error logs?
n

Nicolas Verinaud

06/27/2022, 8:31 PM
Oh I believe I found it
a

Alex Acosta

06/27/2022, 8:31 PM
what was the problem?
n

Nicolas Verinaud

06/27/2022, 8:31 PM
Yup that’s it, it works, problem was the configuration of the target
a

Alex Acosta

06/27/2022, 8:31 PM
nice
n

Nicolas Verinaud

06/27/2022, 8:32 PM
So, solution was adding the things I had in
ios { ... }
in the target
iosSimulatorArm64 { ... }
a

Alex Acosta

06/27/2022, 8:32 PM
makes sense
n

Nicolas Verinaud

06/27/2022, 8:32 PM
Copy code
ios {
        binaries {
            framework {
                baseName = "shared"
                transitiveExport = true
                export("dev.icerock.moko:graphics:0.6.1")
                export("dev.icerock.moko:resources:0.20.1")
            }
        }
    }
    iosSimulatorArm64() {
        binaries {
            framework {
                baseName = "shared"
                transitiveExport = true
                export("dev.icerock.moko:graphics:0.6.1")
                export("dev.icerock.moko:resources:0.20.1")
            }
        }
    }
A bit of cleaning and we’re good to go. Thanks @Alex Acosta !
3
20 Views