AngeloAvv / flutter_flavorizr

A flutter utility to easily create flavors in your flutter application
https://pub.dev/packages/flutter_flavorizr
MIT License
456 stars 81 forks source link

Issue : file not found. #180

Closed AntoineWaes closed 11 months ago

AntoineWaes commented 1 year ago

Hello, I keep running issue when executing the command.

Running FileProcessor: writing file .tmp/ios/firebaseScript.sh with nested IOSFirebaseScriptProcessor Running ShellProcessor: Running script 'ruby' with arguments .tmp/scripts/ios/add_firebase_build_phase.rb, ios/Runner.xcodeproj, .tmp/ios/firebaseScript.sh /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in require': **cannot load such file** -- xcodeproj (LoadError) from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:inrequire' from .tmp/scripts/ios/add_firebase_build_phase.rb:1:in `

'

The rest is working fine, but all the Xcode config files are not generated :

ruby: No such file or directory -- .tmp/scripts/ios/add_file.rb (LoadError)

Could you help ?

here is the config file :

flavorizr: ide: "vscode" flavors: roomvi_dev: app: name: "-----"

  android:
    applicationId: "------"
    firebase:
      config: "firebase/dev/google-services.json"

  ios:
    bundleId: "------"
    firebase:
      config: "firebase/dev/GoogleService-Info.plist"

roomvi:
  app:
    name: "-----"

  android:
    applicationId: "------"
    firebase:
      config: "firebase/prod/google-services.json"
  ios:
    bundleId: "-----"
    firebase:
      config: "firebase/prod/GoogleService-Info.plist"
AntoineWaes commented 1 year ago

Updates : I've updated gem, home-brew and Xcode Now, I've got this error :

.tmp/scripts/ios/add_build_configuration.rb:23:in <main>': undefined methodbuild_settings' for nil:NilClass (NoMethodError)

build_config.build_settings = base_config.build_settings.clone

AngeloAvv commented 1 year ago

Hey @AntoineWaes , what's the output of xcodeproj --version?

duchv-nws commented 1 year ago

I same error xcode 14.2 flutter 3.10

ruby: No such file or directory -- .tmp/scripts/darwin/add_build_configuration.rb (LoadError)

takekapp1990 commented 1 year ago

Hi. I had the same error and found solution for me.

I encountered the error when I run below:

flutter pub run flutter_flavorizr -p ios:xcconfig
#console out: ruby: No such file or directory -- .tmp/scripts/darwin/add_file.rb (LoadError)

Solution:

Get all the needed files from assets and run target action:

flutter pub run flutter_flavorizr -p assets:download assets:extract ios:xcconfig assets:clean
# (assets:clean is optional.)

reference: https://github.com/AngeloAvv/flutter_flavorizr/blob/80e8967e035d7d3a23a3733cfcdcb45508c6d000/lib/src/processors/processor.dart

devkirch commented 5 months ago

@takekapp1990 Hi, i face the same issue. I dont quite understand your Solution. What do you mean by get all the needed files? Your Command does not help in my case.

takekapp1990 commented 5 months ago

@devkirch Hi. You can get all the needed files by setting assets:download process as below. Then, set some process you need like ios:xcconfig and so on. Lastly, you can delete downloaded files by setting assets:clean.

flutter pub run flutter_flavorizr -p assets:download assets:extract ios:xcconfig assets:clean
# (assets:clean is optional.)
devkirch commented 5 months ago

@takekapp1990 Thank you, I already fixed my problem. I had custom instructions where the assets:clean was run right after the assets:download, which obviously deletes the files.

isacmoura commented 3 months ago

If none of the above solutions works for you (my case), I tried the following:
My problem started when I tried to add Firebase processor with the command flutter pub run flutter_flavorizr -p google:firebase. Then I got the error Unhandled exception: Exception: ruby: No such file or directory -- .tmp/scripts/darwin/add_file.rb (LoadError). For solving this:

  1. Generated the assets with flutter pub run flutter_flavorizr -p assets:download assets:extract -p google:firebase. I got the same error but a zipped file named assets.tmp.zip was generated in the root of the project.
  2. I extracted this file and renamed the tmp folder to .tmp.
  3. Run the command again: flutter pub run flutter_flavorizr -p google:firebase
calvinandhika commented 2 weeks ago

Updates : I've updated gem, home-brew and Xcode Now, I've got this error :

.tmp/scripts/ios/add_build_configuration.rb:23:in <main>': undefined methodbuild_settings' for nil:NilClass (NoMethodError)

build_config.build_settings = base_config.build_settings.clone

any luck in fixing this issue?