Trouble building app android using eas with dynamic app.config.js

In your post, please share:

  • Whether you are bare or managed workflow: bare
  • Your eas-cli version: eas-cli/3.13.0 darwin-arm64 node-v18.16.0
  • What you have tried so far:

I’m having a hard time to setup a profiles based app for a white label.
I’m using the dynamic app.config.js/ts option when configuring my expo app.

It keeps giving the same error, like it cannot identify the android property under mey app config object.

This is the output of eas build

I am using the Solito minimal starter template.

Here are my files:

// apps/expo/profiles/one.config.ts
import { ExpoConfig } from 'expo/config'

const config: ExpoConfig = {
  name: 'one',
  slug: 'one-app',
  version: '1.0.0',
  scheme: 'one-app',
  platforms: ['ios', 'android'],
  ios: {
    bundleIdentifier: 'br.com.brunoamorim.one',
  },
  android: {
    package: 'br.com.brunoamorim.one',
    versionCode: 1,
  },
  extra: {
    eas: {
      //...
    },
  },
}

export default config
// apps/expo/profiles/index.ts
import one from './one.config'
export { one }
// apps/expo/app.config.js
// Uses ts-node to transpile typescript files
// Using typescript files to have intellisense on creating app.config
// with ExpoConfig interface
require('ts-node/register')

// Import the app profiles
const appConfigProfile = require('./profiles')

module.exports = () => {
  // Return th app config based on the APP env variable
  // To pass the variable value use cross-env script (->README.md<-)
  const app = { ...appConfigProfile[process.env.APP] }
  console.log(app)
  return app
}

// The "console.log(app)" prints this below
// {
//   name: 'one',
//   slug: 'one-app',
//   version: '1.0.0',
//   scheme: 'one-app',
//   platforms: [ 'ios', 'android' ],
//   ios: { bundleIdentifier: 'br.com.brunoamorim.one' },
//   android: { package: 'br.com.brunoamorim.one', versionCode: 1 },
//   extra: { eas: { projectId: '...' } }
// }

I am using the following command:

APP=one npx eas-cli build

Anyone can help me on what am i doing wrong?

you are setting APP only locally, when app.config.js is evaluated on server it’s not set.

I would recommend creating separate build profile in eas.json e.g.

"production-one": {
  "env": {
    "APP": "one"
  },
  ...
}

if you have a lot profiles, and don’t want to duplicate all the configs for one profile you can do

"production-one": {
  "extends": "base-production", // where base production contains all the common values
  "env": {
    "APP": "one"
  },
}
1 Like

Thanks for the suggestion,

It did the trick!

I’ve tried the following command and config at eas.json, and it worked!

APP=one npx eas-cli build --profile production-one
{
  "cli": {
    "version": ">= 3.13.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {},
    "production-one": {
      "env": {
        "APP": "one"
      }
    }
  },
  "submit": {
    "production": {}
  }
}

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.