Search code examples
android-studiokotlinkmm

KMM: embedAndSignAppleFrameworkForXcode task not found


I have created a basic KMM by following "Create your first app" guide https://kotlinlang.org/docs/kmm-create-first-app.html

Then I've tried to build the framework with the following command from Terminal in Android Studio. ./gradlew :shared:embedAndSignAppleFrameworkForXcode

But I'm getting this error. Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'.

Android Studio 2020.3.1 Patch 3 Kotlin 1.5.31

There's a similar question on SO. People say that embedAndSignAppleFrameworkForXcode should work with Kotlin 1.5.20 at least. KMM - Error Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared' But it doesn't in my setup.

Does anyone know how to fix this?

UPDATE The task is running perfectly fine when launched form XCode/Build Phases script. Somehow it is not able to launch from terminal (Android Studio or system one).


Solution

  • I think embedAndSignAppleFrameworkForXcode is not supposed to run from the terminal as packForXCode used be.

    The proper way to run this task is from XCode build system.

    Anyway, I was able to run embedAndSignAppleFrameworkForXcode from terminal after exporting the following variables.

    export CONFIGURATION\=Debug
    export ARCHS\=x86_64
    export EXPANDED_CODE_SIGN_IDENTITY\=-
    export FRAMEWORKS_FOLDER_PATH\=iosApp.app/Frameworks
    export SDK_NAME\=iphonesimulator15.0
    export TARGET_BUILD_DIR\="../build/ios/${CONFIGURATION}-iphonesimulator"