EAS Build Alternative Bundle Identifiers

I am using EAS build to create different app versions for different environments (production, staging etc) using profiles which is working well. I would now like to use different bundle identifiers to allow different versions to be installed simultaneously. In short, my question is how can I do this?

I am using managed builds and I have tried setting the bundle identifier using ios.bundleIdentifier in app.config.js loaded from an environment variable set in eas.json. At the same time I set the name value to an environment variable. For some reason this is causing the following error during the ā€œConfigure Xcode projectā€ build step.

error Could not find target 'XXXXX' in project.pbxproj

Am I doing something wrong or am I on completely the wrong track?

EAS CLI version 0.15, eas build problem - #5 by wkozyra seems to allude to support for multiple bundle identifiers in 0.17.0 but I am not sure what I need to do to take advantage of this.

Thank you for your help

name field is used to generate the target name in native code. I see in your logs that you have env APP_NAME there. Are you also setting that variable in your local environment when calling eas build ?

btw I recommend using Eas secrets for any keys you need to have specified as envs, even if they are embedded in the app

Thank you for your reply. I am not currently setting the variable locally, no. Presumably if I am triggering the build from CI (which I am not currently whilst sorting this problem), I need to set it there too?

Setting the environment variable has changed things but Iā€™m still getting the same error, just now with a more correct name.

The value in name includes spaces and brackets which have been stripped out in the error. Could this causing my current problem?

name in app.config.json needs to be the same in environment where you are calling eas build and in environment on eas builder.
Based on the last build on your account Iā€™m assuming that in CI you are setting XXXXX (Staging Sandbox) and in eas.json XXXXX (Staging Live)

Ah yes, thank you. Seems to be all sorted now. Thank you for your help.

Hi There! Running into the same issue. Can you please walk thru the exact solution/share your eas.json/app.config.json? @staxy

We have multiple app.environent_name.json files with different bundle identifiers and app.config.js that select the config file to use base on APP_ENV variable like so:

module.exports = () => {
    if (process.env.APP_ENV === "production") {
        return require("./app.production.json");
    } else if (process.env.APP_ENV === "beta") {
        return require("./app.beta.json");
    } else if (process.env.APP_ENV === "staging") {
        return require("./app.staging.json");
    } else {
        return require("./app.develop.json");
    }
};

eas.json look like this:

{
    "build": {
        "staging": {
            "distribution": "internal",
            "releaseChannel": "staging-2.4.eas",
            "cache": {
                "key": "SDK42-staging"
            }
        },
        "beta": {
            "distribution": "internal",
            "releaseChannel": "beta-2.4.eas",
            "cache": {
                "key": "SDK42-beta"
            }
        },
        "production": {
            "releaseChannel": "production-2.4.eas",
            "cache": {
                "key": "SDK42-production"
            }
        }
    }
}

and calling the build command in CLI like that:

APP_ENV=environent_name eas build --profile profile_name --platform all

getting Could not find target 'app_name' in project.pbxproj for any other environment other than the original build

CC: @wkozyra

1 Like

assuming that this is managed project, you need to add env: { APP_ENV: "environent_name" } to build profiles in eas.json. Otherwise app.json resolved in cli and on the builder is different.

2 Likes

Hey, I got the same issue when trying to configure the same thing as he didnā€™t mentioned above. And I am getting this error mesasge Could not find target ā€˜XXXXā€™ in project.pbxproj

Hereā€™s my eas config

  "cli": {
    "version": ">= 0.45.0"
  },
  "build": {
    "development": {
      "releaseChannel": "development",
      "env": {
        "ENV": "public",
        ...
      }
    },
    "production": {
      "releaseChannel": "production",
      "env": {
        "ENV": "public",
         ...
      }
    }
  },
  "submit": {
    "development": {},
    "production": {}
  }
}

I was wondering how does the name inside expo name inside app.config.js tries to the provisioning profileā€™s name or the identifier?