AngeloAvv / flutter_flavorizr

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

Error on ios:buildTargets task #274

Open maxiBon18 opened 4 months ago

maxiBon18 commented 4 months ago

Hi everyone, For a while now I have been unable to launch and successfully complete the “flutter pub run flutter_flavorizr” command as I constantly get this exception when I get to the ios:buildTargets task:

Executing task ios:buildTargets Running XcodeprojProcessor: Checking if xcodeproj is installed Running DarwinBuildConfigurationsProcessor Running ShellProcessor: Running script 'ruby' with arguments .tmp/scripts/darwin/add_build_configuration.rb, ios/Runner.xcodeproj, Flutter/devDebug.xcconfig, dev, com.enel.mobile.pltsnoopmobile.dev.dev, Debug, eyJBU1NFVENBVEFMT0dfQ09NUElMRVJfQVBQSUNPTl9OQU1FIjoiJChBU1NFVF9QUkVGSVgpQXBwSWNvbiIsIkxEX1JVTlBBVEhfU0VBUkNIX1BBVEhTIjoiJChpbmhlcml0ZWQpIEBleGVjdXRhYmxlX3BhdGgvRnJhbWV3b3JrcyIsIlNXSUZUX09CSkNfQlJJREdJTkdfSEVBREVSIjoiUnVubmVyL1J1bm5lci1CcmlkZ2luZy1IZWFkZXIuaCIsIlNXSUZUX1ZFUlNJT04iOiI1LjAiLCJGUkFNRVdPUktfU0VBUkNIX1BBVEhTIjpbIiQoaW5oZXJpdGVkKSIsIiQoUFJPSkVDVF9ESVIpL0ZsdXR0ZXIiXSwiTElCUkFSWV9TRUFSQ0hfUEFUSFMiOlsiJChpbmhlcml0ZWQpIiwiJChQUk9KRUNUX0RJUikvRmx1dHRlciJdLCJJTkZPUExJU1RfRklMRSI6IlJ1bm5lci9JbmZvLnBsaXN0IiwiUFJPRFVDVF9CVU5ETEVfSURFTlRJRklFUiI6ImNvbS5lbmVsLm1vYmlsZS5wbHRzbm9vcG1vYmlsZS5kZXYuZGV2In0= Running ShellProcessor: Running script 'ruby' with arguments .tmp/scripts/darwin/add_build_configuration.rb, ios/Runner.xcodeproj, Flutter/devProfile.xcconfig, dev, com.enel.mobile.pltsnoopmobile.dev.dev, Profile, eyJBU1NFVENBVEFMT0dfQ09NUElMRVJfQVBQSUNPTl9OQU1FIjoiJChBU1NFVF9QUkVGSVgpQXBwSWNvbiIsIkxEX1JVTlBBVEhfU0VBUkNIX1BBVEhTIjoiJChpbmhlcml0ZWQpIEBleGVjdXRhYmxlX3BhdGgvRnJhbWV3b3JrcyIsIlNXSUZUX09CSkNfQlJJREdJTkdfSEVBREVSIjoiUnVubmVyL1J1bm5lci1CcmlkZ2luZy1IZWFkZXIuaCIsIlNXSUZUX1ZFUlNJT04iOiI1LjAiLCJGUkFNRVdPUktfU0VBUkNIX1BBVEhTIjpbIiQoaW5oZXJpdGVkKSIsIiQoUFJPSkVDVF9ESVIpL0ZsdXR0ZXIiXSwiTElCUkFSWV9TRUFSQ0hfUEFUSFMiOlsiJChpbmhlcml0ZWQpIiwiJChQUk9KRUNUX0RJUikvRmx1dHRlciJdLCJJTkZPUExJU1RfRklMRSI6IlJ1bm5lci9JbmZvLnBsaXN0IiwiUFJPRFVDVF9CVU5ETEVfSURFTlRJRklFUiI6ImNvbS5lbmVsLm1vYmlsZS5wbHRzbm9vcG1vYmlsZS5kZXYuZGV2In0= Unhandled exception: Exception: .tmp/scripts/darwin/add_build_configuration.rb:23:in <main>': undefined methodbuild_settings' for nil:NilClass (NoMethodError)

0 ShellProcessor.execute (package:flutter_flavorizr/src/processors/commons/shell_processor.dart:51:7)

1 QueueProcessor.execute (package:flutter_flavorizr/src/processors/commons/queue_processor.dart:44:17)

2 QueueProcessor.execute (package:flutter_flavorizr/src/processors/commons/queue_processor.dart:44:17)

3 Processor.execute (package:flutter_flavorizr/src/processors/processor.dart:140:24)

I can't figure out why, below I put my flavorizr entered in pubspec.yaml flavorizr: app: android: flavorDimensions: "flavor-type" instructions: - assets:download - assets:extract - android:androidManifest - android:buildGradle - android:dummyAssets - android:icons - flutter:flavors - flutter:app - flutter:pages - flutter:main - flutter:targets - ios:podfile - ios:xcconfig - ios:buildTargets - ios:schema - ios:dummyAssets - ios:icons - ios:plist - ios:launchScreen - assets:clean - ide:config ide: vscode flavors: dev: app: name: "enelmobilesnooptest dev" android: applicationId: "com.enel.mobile.pltsnoopmobile.dev" ios: bundleId: "com.enel.mobile.pltsnoopmobile.dev.dev" qa: app: name: "enelmobilesnooptest qa" android: applicationId: "com.enel.mobile.pltsnoopmobile.qa" ios: bundleId: "com.enel.mobile.pltsnoopmobile.dev.qa" prod: app: name: "enelmobilesnooptest prod" android: applicationId: "com.enel.mobile.pltsnoopmobile.prod" ios: bundleId: "com.enel.mobile.pltsnoopmobile.dev.prod" Can you help me? Thanks, Massimo
maxiBon18 commented 4 months ago

flutter_flavorizr: ^2.2.3

oboard commented 3 months ago

same problem

abnerh69sparq commented 3 months ago

Same here!

AngeloAvv commented 3 months ago

Hello @maxiBon18 , according to your error message, looks like you're using an older version of flutter_flavorizr. Can you please try to update it to the latest version?

If the error persists, I suggest you try to reproduce it with a fresh and new Flutter project to see what happens. I strongly believe there's something wrong with your Darwin's project configuration and it would be simpler to recreate it and start over instead of looking for the needle in the haystack.

hussruss commented 1 month ago

Hello (@maxiBon18 ),

I fixed this problem by addressing an issue with the build configurations in Xcode.

The root cause of the error was that base_config was nil because it could not find any configuration with config.name matching mode. The issue was that in the Xcode project settings, under Runner > Info > Configuration, there were no configurations set for the Debug, Release, or Profil modes.

Here are the steps to resolve this issue:

  1. Open your project in Xcode by navigating to ios/Runner.xcworkspace.

  2. Go to Runner > Info.

  3. Under the Configurations section, ensure that you have valid entries for each of the following configurations:

    • Debug
    • Release
    • Profil

    If any of these configurations are missing, create or assign them as needed.

    Fix

  4. Once the configurations are correctly set up, re-run the script. The base_config should now be properly assigned, and the build_settings will no longer be nil.

This should resolve the undefined method 'build_settings' for nil:NilClass (NoMethodError) issue you were encountering.

I hope this helps! Let me know if further assistance is needed.

ccharp commented 3 weeks ago

@hussruss this solved my issue -- thank you!