AngeloAvv / flutter_flavorizr

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

Project does not build in ios #24

Closed lucasdidur closed 3 years ago

lucasdidur commented 4 years ago

Hello,

I create 2 flavors, and added just this dependency:

  firebase_core: "^0.5.0"
  cloud_firestore: ^0.14.0+2

When i try to run, i get this error.

flutter run --flavor dev -t lib/main-dev.dart

    diff: /Podfile.lock: No such file or directory
    diff: /Manifest.lock: No such file or directory
    error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
    note: Using new build system
    note: Planning build
    note: Constructing build description

When i run just flutter run works normally.

AngeloAvv commented 4 years ago

Hi @lucasdidur,

did you put the Pods include in each of your xcconfig flavor just before the Generated include?

#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.<destination>.xcconfig"

where destination is debug or release

adamanderson86 commented 4 years ago

I'm also having a similar issue if you could help, please :-) I have added the below to my devDebug.xcconfig file resulting in the below:

Any help would be amazing.

#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"

FLUTTER_TARGET=lib/main-dev.dart

ASSET_PREFIX=dev
BUNDLE_NAME=Appname DEV

I have cleaned and rebuild but still get the below error, I know what the issue is I just don't have the iOS knowledge to figure it out.

    /Users/admin/Development/Flutter/karbon_fit_app/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'shared_preferences' not found
    @import shared_preferences;
     ~~~~~~~^~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
wwwdata commented 3 years ago

I just started a new project to try it out and got it working. The only thing I had to change was to exchange iphoneos from the Base SDK setting in Xcode to iOS. Strange that it was set to that, but whatever. Also had to include those Pod imports, and then got it working.

Screen Shot 2020-10-28 at 11 57 22

However, I also got this GeneratedPluginRegistrant.m error in an existing project, and I could trace that down to a wrong configuration in the Info tab inside the Runner Project configuration in Xcode. Basically, the new environment was configured for the Runner project, and not the Runner target. By setting my new flavor (in my case qaDebug) for the target, it compiled and worked. See my next screenshot. So:

Screen Shot 2020-10-28 at 12 04 00

So: all working, can you check if that also solves it for you @adamanderson86 ?

AngeloAvv commented 3 years ago

Can anyone please tell me if something has changed with flutter_flavorizr 1.0.11 ?

p02diada commented 3 years ago

Same problem here, I have solved it adding the imports to the xxcconfig files:

#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.<destination>.xcconfig"

And then we have to open xcode and update the config:

  1. Go to Xcode > Project > Info > Configurations
  2. Set the values for Debug > Pods-XXX.debug and Release = Pods-XXX.release
h-unterp commented 1 year ago

Still seeing the issue at top. Tried everything here, none of it made sense, and was unable to build in Xcode.

What did work....is

flavorizr: ide: "vscode"

as described in: https://pierre-dev.hashnode.dev/get-the-best-out-of-flutter-flavors-with-flutterflavorizr

fpoppinga commented 1 year ago

I ran into the same issue and what helped was to touch the build settings for the generated configurations in xcode:

image

This is of course not really a "fix", but this results in the addition of the following lines in the project.pbxproj:

        72234490296727B400F3F89E /* Debug-dev */ = {
            isa = XCBuildConfiguration;
            baseConfigurationReference = 3F86FA4672AABCB51C577040 /* Pods-Runner.debug-dev.xcconfig */;
            buildSettings = {
                PRODUCT_NAME = Runner;
            };
            name = "Debug-dev";
        };
        72234491296727B400F3F89E /* Profile-dev */ = {
            isa = XCBuildConfiguration;
            baseConfigurationReference = DA01EB1BCE28D1C54F0CA6CA /* Pods-Runner.profile-dev.xcconfig */;
            buildSettings = {
                PRODUCT_NAME = Runner;
            };
            name = "Profile-dev";
        };
        72234492296727B400F3F89E /* Release-dev */ = {
            isa = XCBuildConfiguration;
            baseConfigurationReference = 905FC84C19864588829C60C2 /* Pods-Runner.release-dev.xcconfig */;
            buildSettings = {
                PRODUCT_NAME = Runner;
            };
            name = "Release-dev";
        };
        72234493296727B400F3F89E /* Debug-prod */ = {
            isa = XCBuildConfiguration;
            baseConfigurationReference = AA5357F7199284C3C08928CF /* Pods-Runner.debug-prod.xcconfig */;
            buildSettings = {
                PRODUCT_NAME = Runner;
            };
            name = "Debug-prod";
        };
        72234494296727B400F3F89E /* Profile-prod */ = {
            isa = XCBuildConfiguration;
            baseConfigurationReference = 997507D4D51591BD1E842AE7 /* Pods-Runner.profile-prod.xcconfig */;
            buildSettings = {
                PRODUCT_NAME = Runner;
            };
            name = "Profile-prod";
        };
        72234495296727B400F3F89E /* Release-prod */ = {
            isa = XCBuildConfiguration;
            baseConfigurationReference = 75150F32C9248992B4630230 /* Pods-Runner.release-prod.xcconfig */;
            buildSettings = {
                PRODUCT_NAME = Runner;
            };
            name = "Release-prod";
        };

i.e. some sort of configuration for each of the flavors, which seems to not exist beforehands.

As my main goal with using flutter is to not try and understand whatever things happen in xcode, I hope that his helps you @AngeloAvv to maybe get an idea what the problem is.