Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin multiplatform mobile - fail to run iOS project - missing one or more architectures required by this target

I create KMM(Kotlin multiplatform mobile) project using Android studio 4.1 RC3 and try to run the iOS App (with default code) but stuck with following error:

error : The linked and embedded framework 'shared.framework' is missing one or more architectures required by this target: arm64. (in target 'iosApp' from project 'iosApp')

But when I just hit 'build', it get built successfully. Only happening only when hit 'run' from Android studio. Mean while I used Xcode to run the same project and face no issues getting it deployed into the simulator successfully.

By the way I was following this official KMM guide https://kotlinlang.org/docs/mobile/create-first-app.html

Using Xcode 14 ( I tried simulators with iOS14,13.5,12.1) using Mac OS Catalina 10.15.6

like image 295
Niroshan Avatar asked Sep 21 '20 11:09

Niroshan


People also ask

How do I create an iOS app with Kotlin multiplatform mobile?

Before you create your first application that works on both iOS and Android, you'll need to set up an environment for Kotlin Multiplatform Mobile development. To write iOS-specific code and run an iOS application on a simulated or real device, you'll need a Mac with macOS.

How do I update the Kotlin version in Android Studio?

To update the Kotlin version, in Android Studio select Tools | Kotlin | Configure Kotlin Plugin Updates. To update the Kotlin Multiplatform Mobile plugin, select Settings/Preferences | Tools | Plugins. Next to the plugin name, click Update. Make sure you have the CocoaPods dependency manager installed. We recommend using the latest Kotlin version.

What are the benefits of Kotlin for multiplatform programming?

Support for multiplatform programming is one of Kotlin’s key benefits. It reduces time spent writing and maintaining the same code for different platforms while retaining the flexibility and benefits of native programming.

How do I create a multi-platform project in Android Studio?

Just head over to Android Studio and open your local.properties and copy the sdk.dir value from there to the corresponding file in the Multiplatform project. You can now continue to build your project. The project is created with a few source sets commonMain, commonTest, iosMain etc.


1 Answers

This problem is most probably caused by Xcode 12 adding new simulator architectures. As a workaround, one can try adding arm64 to the Disable Architectures list in Build Settings. See the related issue here

like image 135
Artyom Degtyarev Avatar answered Oct 30 '22 23:10

Artyom Degtyarev