flutter_flavorizr icon indicating copy to clipboard operation
flutter_flavorizr copied to clipboard

Multiple commands produce GoogleService-Info.plist

Open Rameshv opened this issue 3 years ago • 2 comments

Hi, I have 2 different flavors with different firebase configs. It works flawlessly in Android.

But I can't able to build the app in Xcode as it throws Multiple commands produce GoogleService-Info.plist error. Heres the error

Multiple commands produce '/Users/rameshvel/Library/Developer/Xcode/DerivedData/Runner-gqmldwjuahwuwkgijmfokisjscam/Build/Products/Debug-AppleApp-iphonesimulator/Runner.app/GoogleService-Info.plist':
1) Target 'Runner' (project 'Runner') has copy command from '/Users/rameshvel/work/storeJam/modernkirana/apps/customer/ios/Runner/OrangeApp/GoogleService-Info.plist' to '/Users/rameshvel/Library/Developer/Xcode/DerivedData/Runner-gqmldwjuahwuwkgijmfokisjscam/Build/Products/Debug-AppleApp-iphonesimulator/Runner.app/GoogleService-Info.plist'
2) Target 'Runner' (project 'Runner') has copy command from '/Users/rameshvel/work/storeJam/modernkirana/apps/customer/ios/Runner/AppleApp/GoogleService-Info.plist' to '/Users/rameshvel/Library/Developer/Xcode/DerivedData/Runner-gqmldwjuahwuwkgijmfokisjscam/Build/Products/Debug-AppleApp-iphonesimulator/Runner.app/GoogleService-Info.plist'

A quick look at the copy bundle resource in the build phase revealed that flutter_flavorizr added a copy phase for GoogleService-Info.plist for both the flavors.

I know I can remove just a unused flavor and add it back when I am building that one. Is there a simple way?

Rameshv avatar Apr 13 '21 15:04 Rameshv

Hi @Rameshv , this looks weird. flutter_flavorizr checks if a previously defined build phase was there, and if so, it removes it and readds with the updated references. Maybe you previously customized the name of the "Firebase Setup" script?

AngeloAvv avatar Jun 03 '21 12:06 AngeloAvv

Hi @Rameshv, I had the same problem, try to remove all references to GoogleService-Info.plist in Build Phases -> Copy Bundle Resources.

Cyril212 avatar Nov 15 '21 13:11 Cyril212

Thank you @Cyril212 , this solved my problem also.

onkarmishra27 avatar Sep 23 '22 07:09 onkarmishra27

Hi @Rameshv, I had the same problem, try to remove all references to GoogleService-Info.plist in Build Phases -> Copy Bundle Resources.

great bro, tks

ngominhtrungit avatar Oct 27 '22 16:10 ngominhtrungit

Hi @Rameshv , this looks weird. flutter_flavorizr checks if a previously defined build phase was there, and if so, it removes it and readds with the updated references. Maybe you previously customized the name of the "Firebase Setup" script?

Thank you this solve my problem

Thank you @Cyril212 , this solved my problem also.

VidyaRajan7 avatar Dec 23 '22 00:12 VidyaRajan7

Hi @Rameshv, I had the same problem, try to remove all references to GoogleService-Info.plist in Build Phases -> Copy Bundle Resources.

u are my hero 😄

saturnedev12 avatar Jan 01 '23 12:01 saturnedev12

Hi @Rameshv, I had the same problem, try to remove all references to GoogleService-Info.plist in Build Phases -> Copy Bundle Resources.

What do you mean I do not understand.

JonathanVegafz avatar Feb 24 '23 19:02 JonathanVegafz

Hi @Rameshv, I had the same problem, try to remove all references to GoogleService-Info.plist in Build Phases -> Copy Bundle Resources.

What do you mean I do not understand.

Here's how you can do that:

  1. Open your Xcode project.
  2. In the left-hand navigation pane, select your project to open the project editor.
  3. In the project editor, select your target.
  4. Select the "Build Phases" tab.
  5. Expand the "Copy Bundle Resources" section.
  6. Look for any references to GoogleService-Info.plist in the list of resources. You can identify it by its icon, which should look like a blue file with a white "G" on it.
  7. If you find any references to GoogleService-Info.plist, select them and press the "-" button to remove them from the list.
  8. Repeat step 7 for any additional references to GoogleService-Info.plist.
  9. Once you have removed all references to GoogleService-Info.plist from the "Copy Bundle Resources" build phase, save your changes and try building your Xcode project again.

By removing all references to GoogleService-Info.plist from the "Copy Bundle Resources" build phase, you are ensuring that Xcode does not try to copy the file to the app bundle more than once, which can cause conflicts and errors like the one described in the GitHub issue.

atsokha avatar May 03 '23 08:05 atsokha

Hi @Rameshv, I had the same problem, try to remove all references to GoogleService-Info.plist in Build Phases -> Copy Bundle Resources.

What do you mean I do not understand.

Here's how you can do that:

  1. Open your Xcode project.
  2. In the left-hand navigation pane, select your project to open the project editor.
  3. In the project editor, select your target.
  4. Select the "Build Phases" tab.
  5. Expand the "Copy Bundle Resources" section.
  6. Look for any references to GoogleService-Info.plist in the list of resources. You can identify it by its icon, which should look like a blue file with a white "G" on it.
  7. If you find any references to GoogleService-Info.plist, select them and press the "-" button to remove them from the list.
  8. Repeat step 7 for any additional references to GoogleService-Info.plist.
  9. Once you have removed all references to GoogleService-Info.plist from the "Copy Bundle Resources" build phase, save your changes and try building your Xcode project again.

By removing all references to GoogleService-Info.plist from the "Copy Bundle Resources" build phase, you are ensuring that Xcode does not try to copy the file to the app bundle more than once, which can cause conflicts and errors like the one described in the GitHub issue.

thanks it works

iTomCat avatar Jul 09 '23 10:07 iTomCat

@Rameshv, I had the same problem, try to remove all references to GoogleService-Info.plist in Build Phases -> Copy Bundle Resources.

Hi, I had the same issue and I did this solution but if I remove these references, I get this error while building using vscode with a launch.json configuration: Error (Xcode): lib/main.dart: Error: Error when reading 'lib/main.dart': No such file or directory

Here is my launch.json: "configurations": [ { "name": "my-app dev", "request": "launch", "type": "dart", "program": "lib/main_development.dart", "args": [ "--target", "lib/main_development.dart", "--flavor", "development",] }, { "name": "my-app staging", "request": "launch", "type": "dart", "program": "lib/main_staging.dart", "args": [ "--target", "lib/main_staging.dart", "--flavor", "staging",] }, { "name": "my-app production", "request": "launch", "type": "dart", "program": "lib/main_production.dart", "args": [ "--target", "lib/main_production.dart", "--flavor", "production",] } ] }

yannwehrlin avatar Nov 24 '23 20:11 yannwehrlin

@Cyril212 Thanks for the reply It worked for me

muxtorovinomjon0227 avatar Apr 06 '24 00:04 muxtorovinomjon0227