invertase / flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Apache License 2.0
173 stars 49 forks source link

[bug]: (macOS) error: Unexpected duplicate tasks #123

Closed JagandeepBrar closed 2 years ago

JagandeepBrar commented 2 years ago

Is there an existing issue for this?

CLI Version

0.2.6

Firebase Tools version

11.15.0

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.3.5, on macOS 12.5 21G72 darwin-x64, locale en-CA) • Flutter version 3.3.5 on channel stable at /Users/jagandeepbrar/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision d9111f6402 (2 days ago), 2022-10-19 12:27:13 -0700 • Engine revision 3ad69d7be3 • Dart version 2.18.2 • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/jagandeepbrar/Library/Android/sdk • Platform android-33, build-tools 33.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 14.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14A400 • CocoaPods version 1.11.3

[✓] 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.72.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.50.0

[✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 12.5 21G72 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.119

[✓] HTTP Host Availability • All required HTTP hosts are available

• No issues found!

Description

The CLI was able to successfully generate the required files/configurations for macOS, but when actually attempting to build the project I am experiencing an error: Unexpected duplicate tasks.

A verbose log shows:

[  +27 ms] note: Building targets in dependency order
[        ] error: Unexpected duplicate tasks
[        ]     note: Target 'Runner' (project 'Runner') has copy command from '/Users/jagandeepbrar/Git/LunaSea/macos/Runner/GoogleService-Info.plist' to
'/Users/jagandeepbrar/Git/LunaSea/build/macos/Build/Products/Release/LunaSea.app/Contents/Resources/GoogleService-Info.plist'
[        ]     note: Target 'Runner' (project 'Runner') has copy command from '/Users/jagandeepbrar/Git/LunaSea/macos/Runner/GoogleService-Info.plist' to
'/Users/jagandeepbrar/Git/LunaSea/build/macos/Build/Products/Release/LunaSea.app/Contents/Resources/GoogleService-Info.plist'

Steps to reproduce

  1. flutterfire configure --ios-bundle-id={bundle-id} --macos-bundle-id={bundle-id} --platforms=ios,macos --yes
  2. flutter build macos

Expected behavior

There should be no duplicate tasks error and it should be able to successfully build the macOS binary.

Screenshots

No response

Additional context and comments

  1. I have tried flutter clean before building to no success.
  2. Not sure if they are directly correlated but this has started to occur around the release of XCode 14.
  3. This does NOT occur with iOS and those builds complete without issue.
  4. Before there was no reference to GoogleService-Info.plist inside of the project.pbxproj and the changes made to the iOS and macOS project are identical.
JagandeepBrar commented 2 years ago

I think I was able to identify the root cause.

The script is adding GoogleService-Info.plist to the "Compile Sources" build phase when it should be adding it to the "Copy Bundle Resources" build phase. This is what happens when manually adding the GoogleService-Info.plist file and the build is able to complete successfully.

This can also be fixed by running flutterfire configure, opening macos/Runner.xcworkspace, opening GoogleService-Info.plist in the project navigator and in the right-hand pane under "Target Membership", un-check and re-check "Runner".

This builds on iOS without issue even though it does the same thing of adding it to "Compile Sources" instead of "Copy Bundle Resources". Doing the above of either manually adding the plist or toggling the target membership also moves it to the "Copy Bundle Resources" phase on iOS.

lukemmtt commented 1 year ago

I experienced this issue today April 24, 2023.

This piece fixed my problem:

opening macos/Runner.xcworkspace, opening GoogleService-Info.plist in the project navigator and in the right-hand pane under "Target Membership", un-check and re-check "Runner".

Thank you!