Credential settings before EAS build in terminal

Can I set which credentials to use before EAS build or in eas build command?
EAS build uses the default credential automatically, but I want use the new created.
How can I set the default? Can I set which one credential to use in eas.json per profile?
Thanks for answers

You can run eas credentials command in your project from a terminal window to set up a new credential (for example, a new keystore for a development profile for Android).

When you run the command, you will be prompted to select the platform:

CleanShot 2022-10-31 at 18.19.16@2x

After selecting the platform, you can configure for each profile:

Let me know if that helps.

Yes. I did it. I created more credential for development.
But my problem, I can not to set what to use at buildtime when I run the “eas build --platform android --profile development” command. It use automatically the default credential, what I generated in first time. But I can not to change the default or I can not select the credential what I want to use when I build the app

1 Like

Ah okay. My bad for not understanding it clearly the first time.

To use different credentials for a specific build profile (let’s say for "development" and for "production") you will have to set up different bundleIdentifier/package property values.

  1. You will first have to convert app.json file to app.config.js and define an environment variable such as:
const IS_DEV = process.env.APP_VARIANT === 'development';
  1. Then, modify the app.config.js file by editing bundleIdentifier for iOS and package for Android.
const IS_DEV = process.env.APP_VARIANT === 'development';

export default {
  // You can also switch out the app icon and other properties to further
  // differentiate the app on your device.
  name: IS_DEV ? 'MyApp (Dev)' : 'MyApp',
  slug: 'my-app',
  ios: {
    bundleIdentifier: IS_DEV ? 'com.myapp.dev' : 'com.myapp',
  },
  android: {
    package: IS_DEV ? 'com.myapp.dev' : 'com.myapp',
  },
};
  1. modify eas.json to set the APP_VARIANT environment variable when running builds with the "development" profile. For example:
{
  "build": {
    "development": {
      "developmentClient": true,
      "env": {
        "APP_VARIANT": "development"
      }
    },
    "production": {}
  }
}

Note: you can read more about this in our docs.

You can now normally run the eas build command and select the profile, for example, eas build --profile development. This will ask you to create/generate new credentials at build time which will be used for the specific profile once the build is triggered for both profiles (in this example, "development" and "production").

You can also verify the crednetials from Expo account’s dashboard. Open your app at expo.dev/accounts/[username]/projects/[projectname]/credentials.

In Credentials you will see the different Application identifiers (package/bundlerIdentifier) listed for each profile. When selecting them, you will also find that the default Build credentials are different for each profile.

Sorry for the late message. I know the flow is not ideal and I’ve communicated with our team about it.