11.9 C
Canberra
Tuesday, August 19, 2025

android – No such module ‘ComposeApp’ whereas working multiplatform app on iOS


Why it occurs

Once you create a KMP undertaking with Compose Multiplatform, the shared code (together with the Compose UI) is compiled into an iOS framework (often referred to as shared.framework or one thing related) that must be imported into your Xcode undertaking.
If the Xcode undertaking isn’t pointing to the fitting output folder or hasn’t constructed the framework but, Swift will say:

No such module 'ComposeApp'

Steps to repair it

  1. Make sure the iOS framework is constructed

    • In Android Studio (or by way of terminal), run:

      ./gradlew :shared:packForXcode
      
      

      or in case your module is known as in another way:

      ./gradlew :composeApp:syncFramework
      
      

      This activity generates the .framework file in shared/construct/XCFrameworks.

  2. Test your Xcode undertaking setup

    • In your iOS app’s Xcode undertaking, go to Frameworks, Libraries, and Embedded Content material and ensure the generated ComposeApp.xcframework (or no matter it’s named) is added.

    • If it’s lacking, drag it from the Gradle construct output folder into Xcode.

  3. Replace the import path

    • In your Swift code, import it precisely because the framework is known as — if the framework is shared, you’ll use:

      import shared
      
      

      In case your KMP undertaking named it ComposeApp, then:

      import ComposeApp
      
      
  4. Re-sync Gradle and Xcode

    • Typically adjustments don’t mirror till you clear and rebuild:

      ./gradlew clear
      ./gradlew :shared:packForXcode
      
      

      Then in Xcode: Product → Clear Construct Folder and rebuild.

  5. Match the iOS goal

    • Be certain that the Gradle construct is creating the framework for a similar structure your simulator or machine makes use of (arm64 for gadgets, x86_64 for Intel simulators, arm64 for Apple Silicon simulators).

    • For those who run into structure mismatches, you may specify:

      ./gradlew :shared:packForXcode -Pkotlin.native.cocoapods.goal=iosSimulatorArm64
      
      

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles