Skip to content

Problems with building a native watch app alongside my flutter app #43731

Description

@jeanherfs

Please read carefully before closing as a duplicate!

This is related to #20392
But not the same issue as #16092.

The problem is not that there is no support for extensions but that an app that has a native watch app alongside it cannot run.

I created a flutter app with an accompanying apple watch app. The watch app is not written in flutter and is added as an extra target in the Runner project.
When I run both the app and the apple watch app from xcode they work fine.

When I try to run the iOS app (not even the watch app) from Intellij I get following error:
error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator'.

This seems to indicate that flutter with IntelliJ always tries to run to the iPhone only, it does not support running to an iPhone simulator with a watch simulator.

Steps to reproduce:

create flutter app
add apple watch target through xcode.

Activity

  1. jacob314 commented on Oct 23, 2019

    @jacob314
    Contributor
  2. stevemessick commented on Oct 23, 2019

    @stevemessick
    Member

    Actually, I think @pq is our Xcode expert.

  3. stevemessick commented on Oct 29, 2019

    @stevemessick
    Member

    This isn't an IDE problem. You can get the same results running from the command line:

    $ flutter run --machine --track-widget-creation --device-id=4A79B62B-E060-4199-BCBB-D5FD7A65BEED --start-paused lib/main.dart
    
    [{"event":"daemon.connected","params":{"version":"0.5.3","pid":21585}}]
    [{"event":"app.start","params":{"appId":"e73eb179-2b60-48e2-9258-6bc479e20351","deviceId":"4A79B62B-E060-4199-BCBB-D5FD7A65BEED","directory":"/Users/messick/IdeaProjects/watchme","supportsRestart":true,"launchMode":"run"}}]
    Launching lib/main.dart on iPhone Xʀ in debug mode...
    [{"event":"app.progress","params":{"appId":"e73eb179-2b60-48e2-9258-6bc479e20351","id":"0","progressId":null,"message":"Running Xcode build..."}}]
    [{"event":"app.progress","params":{"appId":"e73eb179-2b60-48e2-9258-6bc479e20351","id":"0","progressId":null,"finished":true}}]
    Xcode build done.                                            1.2s
    Failed to build iOS app
    Error output from Xcode build:
    ↳
        ** BUILD FAILED **
    
    
    Xcode's output:
    ↳
        error: unable to resolve product type
        'com.apple.product-type.application.watchapp2' for platform
        'iphonesimulator' (in target 'watchme')
        error: unable to resolve product type
        'com.apple.product-type.application.watchapp2' for platform
        'iphonesimulator' (in target 'watchme')
        error: unable to resolve product type
        'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator'
        (in target 'watchme Extension')
        error: unable to resolve product type
        'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator'
        (in target 'watchme Extension')
        warning: Capabilities for Runner may not function correctly because its
        entitlements use a placeholder team ID. To resolve this, select a
        development team in the build settings editor. (in target 'Runner')
        note: Using new build systemnote: Planning buildnote: Constructing build
        description
    
    Could not build the application for the simulator.
    Error launching application on iPhone Xʀ.
    [{"event":"app.stop","params":{"appId":"e73eb179-2b60-48e2-9258-6bc479e20351"}}]
  4. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    t: xcode"xcodebuild" on iOS and general Xcode project management
    customer: crowdAffects or could affect many people, though not necessarily a specific customer.
    on Oct 29, 2019
  5. added
    c: new featureNothing broken; request for a new capability
    and removed
    customer: crowdAffects or could affect many people, though not necessarily a specific customer.
    on Oct 29, 2019
  6. jmagman commented on Nov 2, 2019

    @jmagman
    Member

    I was able to reproduce this.
    🤔

  7. jmagman commented on Nov 26, 2019

    @jmagman
    Member
    1. SUPPORTED_PLATFORMS= iphoneos for Profile and Relase should be set in the Runner target, not the Runner project.
    2. -sdk iphoneos or -sdk iphonesimulator are set on every flutter build command: Support multi-arch iOS binaries #17312. I believe this should already be handled by the SDKROOT build setting, but I would need to test this.
  8. jmagman commented on May 8, 2020

    @jmagman
    Member

    This was fixed by #51126. Closing!

  9. github-actions commented on Aug 21, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityt: xcode"xcodebuild" on iOS and general Xcode project managementtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions