Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter build ios-framework fails when plugin declares WatchOS target #106488

Open
fwagner opened this issue Jun 23, 2022 · 7 comments
Open

flutter build ios-framework fails when plugin declares WatchOS target #106488

fwagner opened this issue Jun 23, 2022 · 7 comments
Labels
a: existing-apps Integration with existing apps via the add-to-app flow P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team

Comments

@fwagner
Copy link

fwagner commented Jun 23, 2022

Background

Our app includes a Watch App for iOS. To keep all watch related code contained in one place, we have created a plugin that contains both an iOS and a watchOS target in its podspec:

Pod::Spec.new do |s|
  s.name             = 'watch_flutter_plugin'
  s.version          = '1.0.0'
  s.summary          = 'Flutter plugin for watchOS app.'
  s.ios.source_files = 'Classes/src/ios/**/*', 'Classes/src/shared/**/*'
  s.ios.dependency 'Flutter'
  s.ios.deployment_target = '14.0'
  s.watchos.deployment_target = '8.0'
  s.watchos.source_files = 'Classes/src/watchos/**/*', 'Classes/src/shared/**/*'
  s.watchos.resources = 'Assets/**/*'
end

Note: This setup works fine when building the app with flutter build ios, the issue only occurs on flutter build iOS-framework.

Steps to Reproduce

  1. Add a plugin to your app that declares both an iOS and a watchOS target in its podspec file.
  2. Run flutter build ios-framework command

Logs

Logs

flutter build ios-framework --release --target lib/main/main.dart --verbose

(Logs redacted due to confidentiality, full logs are available on request)

                      /<redacted>/ios/Classes/src/watch
                      os/companionAppBridge/CompanionAppBridge.swift:10:8: error: no such module 'WatchKit'
                      import WatchKit
                             ^
[✓] Flutter (Channel stable, 2.5.4-0.0.pre.1, on macOS 12.4 21F79 darwin-x64, locale de-DE)
    • Flutter version 2.5.4-0.0.pre.1 at /Users/.../flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7538428275 (vor 4 Wochen), 2022-05-25 09:03:12 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/.../Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.2.1, Build version 13C100
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.36.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.115

Preliminary analysis

The cause for the error seems to be that the build ios-framework command issues a xcodebuild command that builds all targets with SDK iphoneos (and iphonesimulator in the next command) regardless of the actual platform of the target. This obviously fails for the watchos target as this includes frameworks that are not available in iphoneos SDK.

@huycozy huycozy added the in triage Presently being triaged by the triage team label Jun 24, 2022
@huycozy
Copy link
Member

huycozy commented Jun 24, 2022

Hi @fwagner, thanks for filing the issue.
Flutter doesn't yet fully support watchOS. There's an open #28901 you can refer for further updates.
Closing this as a duplicate.

@huycozy huycozy closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2022
@huycozy huycozy added r: duplicate Issue is closed as a duplicate of an existing issue and removed in triage Presently being triaged by the triage team labels Jun 24, 2022
@fwagner
Copy link
Author

fwagner commented Jun 24, 2022

@huycozy I have to slightly disagree regarding this being a duplicate of #28901. This is not meant to have full WatchOS support for Flutter.
In my opinion this issue is more along the lines of the tooling having to support a Flutter iOS app while having a native WatchIOS App.

@huycozy huycozy reopened this Jun 27, 2022
@huycozy huycozy added in triage Presently being triaged by the triage team and removed r: duplicate Issue is closed as a duplicate of an existing issue labels Jun 27, 2022
@huycozy
Copy link
Member

huycozy commented Jun 27, 2022

@fwagner
I reopen the issue for further investigation.
You are using the old Flutter version 2.5.4-0.0.pre.1, the latest Flutter stable is 3.0.3 and the master is 3.1.0-0.0.pre.1376. Please try upgrading them and retry to see if this issue still reproduces?

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 27, 2022
@fwagner
Copy link
Author

fwagner commented Jun 27, 2022

Thanks @huycozy!

I tried with both the latest versions from stable and master channels and can still reproduce the issue with both of them.

Flutter 3.0.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 676cefaaff (vor 5 Tagen) • 2022-06-22 11:34:49 -0700
Engine • revision ffe7b86a1e
Tools • Dart 2.17.5 • DevTools 2.12.2
Flutter 3.1.0-0.0.pre.1376 • channel master • https://github.com/flutter/flutter.git
Framework • revision 3598f20002 (vor 13 Stunden) • 2022-06-26 18:19:04 -0400
Engine • revision ee56813c14
Tools • Dart 2.18.0 (build 2.18.0-228.0.dev) • DevTools 2.14.1

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 27, 2022
@huycozy
Copy link
Member

huycozy commented Jun 27, 2022

@fwagner
Do you find this issue #92294 similar to yours?
Also, try the solution in #92294 (comment) to see if it helps you to solve the issue.

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 27, 2022
@github-actions
Copy link

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

@jmagman
Copy link
Member

jmagman commented Jul 19, 2022

Reopening, there seems to be enough info here to reproduce, and it seems different than #92294 since flutter build ios succeeded.

@jmagman jmagman reopened this Jul 19, 2022
@jmagman jmagman added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: existing-apps Integration with existing apps via the add-to-app flow P2 Important issues not at the top of the work list and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds in triage Presently being triaged by the triage team labels Jul 19, 2022
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: existing-apps Integration with existing apps via the add-to-app flow P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team
Projects
None yet
Development

No branches or pull requests

4 participants