1---
2title: Install app variants on the same device
3maxHeadingDepth: 4
4description: Learn how to install multiple variants of an app on the same device.
5---
6
7import ImageSpotlight from '~/components/plugins/ImageSpotlight';
8
9When creating [development, preview, and production builds](/build/eas-json/#common-use-cases), installing these build variants simultaneously on the same device is common. This allows working in development, previewing the next version of the app, and running the production version on a device without needing to uninstall and reinstall the app.
10
11This guide provides the steps required to configure multiple (development and production) variants to install and use them on the same device.
12
13## Prerequisites
14
15To have multiple variants of an app installed on your device, each variant must have a unique [Application ID (Android)](/versions/latest/config/app/#package) or [Bundle Identifier (iOS)](/versions/latest/config/app/#bundleidentifier).
16
17## Configure development and production variants
18
19You've created a project using Expo tooling, and now you want to create a development and a production build. Your project's **app.json** may have the following configuration:
20
21```json app.json
22{
23  "expo": {
24    "name": "MyApp",
25    "slug": "my-app",
26    "ios": {
27      "bundleIdentifier": "com.myapp"
28    },
29    "android": {
30      "package": "com.myapp"
31    }
32  }
33}
34```
35
36If your project has EAS Build configured, the **eas.json** also has a similar configuration as shown below:
37
38```json eas.json
39{
40  "build": {
41    "development": {
42      "developmentClient": true
43    },
44    "production": {}
45  }
46}
47```
48
49### Convert app.json to app.config.js
50
51To have multiple variants of the app installed on the same device, rename the **app.json** to **app.config.js** and export the configuration as shown below:
52
53```js app.config.js
54export default {
55  name: 'MyApp',
56  slug: 'my-app',
57  ios: {
58    bundleIdentifier: 'com.myapp',
59  },
60  android: {
61    package: 'com.myapp',
62  },
63};
64```
65
66In **app.config.js**, add an environment variable called `IS_DEV` to switch the `android.package` and `ios.bundleIdentifier` for each variant based on the variable:
67
68{/* prettier-ignore */}
69```js app.config.js
70const IS_DEV = process.env.APP_VARIANT === 'development';
71
72export default {
73  /* @info You can also switch out the app icon and other properties to further differentiate the app on your device. */
74  name: IS_DEV ? 'MyApp (Dev)' : 'MyApp',
75  /* @end */
76  slug: 'my-app',
77  ios: {
78    bundleIdentifier: IS_DEV ? 'com.myapp.dev' : 'com.myapp',
79  },
80  android: {
81    package: IS_DEV ? 'com.myapp.dev' : 'com.myapp',
82  },
83};
84```
85
86In the above example, the environment variable `IS_DEV` is used to differentiate between the development and production environment. Based on its value, the different Application IDs or Bundle Identifiers are set for each variant.
87
88> **Note**: If you are using any libraries that require you to register your application identifier with an external service to use the SDK, such as Google Maps, you'll need to have a separate configuration for that API for the `android.package` and `ios.bundleIdentifier`. You can also swap this configuration using the same approach as above.
89
90### Configuration for EAS Build
91
92In **eas.json**, set the `APP_VARIANT` environment variable to run builds with the **development** profile by using the `env` property:
93
94```json eas.json
95{
96  "build": {
97    "development": {
98      "developmentClient": true,
99      "env": {
100        "APP_VARIANT": "development"
101      }
102    },
103    "production": {}
104  }
105}
106```
107
108Now, when you run `eas build --profile development`, the environment variable `APP_VARIANT` is set to `development` when evaluating **app.config.js** both locally and on the EAS Build builder.
109
110### Using the development server
111
112When you start your development server, you'll need to run `APP_VARIANT=development npx expo start` (or the platform equivalent if you use Windows).
113
114A shortcut for this is to add the following script to your **package.json**:
115
116```json package.json
117{
118  "scripts": {
119    "dev": "APP_VARIANT=development npx expo start"
120  }
121}
122```
123
124### Using production variant
125
126When you run `eas build --profile production` the `APP_VARIANT` variable environment is not set, and the build runs as the production variant.
127
128> **Note**: If you use EAS Update to publish JavaScript updates of your app, you should be cautious to set the correct environment variables for the app variant that you are publishing for when you run the `eas update` command. See the EAS Build [Environment variables and secrets](/build/updates) for more information.
129
130### In bare project
131
132#### Android
133
134In **android/app/build.gradle**, create a separate flavor for every build profile from **eas.json** that you want to build.
135
136```groovy android/app/build.gradle
137android {
138    /* @hide ... */ /* @end */
139    flavorDimensions "env"
140    productFlavors {
141        production {
142            dimension "env"
143            applicationId 'com.myapp'
144        }
145        development {
146            dimension "env"
147            applicationId 'com.myapp.dev'
148        }
149    }
150    /* @hide ... */ /* @end */
151}
152```
153
154> **Note**: Currently, EAS CLI supports only the `applicationId` field. If you use `applicationIdSuffix` inside `productFlavors` or `buildTypes` sections then this value will not be detected correctly.
155
156Assign Android flavors to EAS Build profiles by specifying a `gradleCommand` in the **eas.json**:
157
158```json eas.json
159{
160  "build": {
161    "development": {
162      "android": {
163        "gradleCommand": ":app:assembleDevelopmentDebug"
164      }
165    },
166    "production": {
167      "android": {
168        "gradleCommand": ":app:bundleProductionRelease"
169      }
170    }
171  }
172}
173```
174
175By default, every flavor can be built in either debug or release mode. If you want to restrict some flavor to a specific mode, see the snippet below, and modify **build.gradle**.
176
177```groovy android/app/build.gradle
178android {
179    /* @hide ... */ /* @end */
180    variantFilter { variant ->
181        def validVariants = [
182                ["production", "release"],
183                ["development", "debug"],
184        ]
185        def buildTypeName = variant.buildType*.name
186        def flavorName = variant.flavors*.name
187
188        def isValid = validVariants.any { flavorName.contains(it[0]) && buildTypeName.contains(it[1]) }
189        if (!isValid) {
190            setIgnore(true)
191        }
192    }
193    /* @hide ... */ /* @end */
194}
195```
196
197The rest of the configuration at this point is not specific to EAS, it's the same as it would be for any Android project with flavors. There are a few common configurations that you might want to apply to your project:
198
199- To change the name of the app built with the development profile, create a **android/app/src/development/res/value/strings.xml** file:
200  ```xml android/app/src/development/res/value/strings.xml
201  <resources>
202      <string name="app_name">MyApp - Dev</string>
203  </resources>
204  ```
205- To change the icon of the app built with the development profile, create `android/app/src/development/res/mipmap-*` directories with appropriate assets (you can copy them from **android/app/src/main/res** and replace the icon files).
206- To specify **google-services.json** for a specific flavor, put it in the **android/app/src/&lbrace;flavor&rbrace;/google-services.json** file.
207- To configure sentry, add `project.ext.sentryCli = [ flavorAware: true ]` to **android/app/build.gradle** and name your properties file `android/sentry-{flavor}-{buildType}.properties` (for example, **android/sentry-production-release.properties**)
208
209#### iOS
210
211Assign a different `scheme` to every build profile in **eas.json**:
212
213```json eas.json
214{
215  "build": {
216    "development": {
217      "ios": {
218        "buildConfiguration": "Debug",
219        "scheme": "myapp-dev"
220      }
221    },
222    "production": {
223      "ios": {
224        "buildConfiguration": "Release",
225        "scheme": "myapp"
226      }
227    }
228  }
229}
230```
231
232**Podfile** should have a target defined like this:
233
234```ruby Podfile
235target 'myapp' do
236  # @hide ... #
237  # @end #
238end
239```
240
241Replace it with an abstract target, where the common configuration can be copied from the old target:
242
243```ruby Podfile
244abstract_target 'common' do
245  # put common target configuration here
246
247  target 'myapp' do
248  end
249
250  target 'myapp-dev' do
251  end
252end
253```
254
255Open project in Xcode, click on the project name in the navigation panel, right click on the existing target, and click "Duplicate":
256
257<ImageSpotlight
258  alt="Duplicate Xcode target"
259  src="/static/images/eas-build/variants/1-ios-duplicate-target.png"
260  style={{ maxWidth: 720 }}
261/>
262
263Rename the target to something more meaningful, for example, `myapp copy` -> `myapp-dev`.
264
265Configure a scheme for the new target:
266
267- Go to `Product` -> `Scheme` -> `Manage schemes`.
268- Find scheme `myapp copy` on the list.
269- Change scheme name `myapp copy` -> `myapp-dev`.
270- By default, the new scheme should be marked as shared, but Xcode does not create `.xcscheme` files. To fix that, uncheck the "Shared" checkbox and check it again, after that new `.xcscheme` file should show up in the **ios/myapp.xcodeproj/xcshareddata/xcschemes** directory.
271
272<ImageSpotlight
273  alt="Xcode scheme list"
274  src="/static/images/eas-build/variants/2-scheme-list.png"
275  style={{ maxWidth: 720 }}
276/>
277
278By default, the newly created target has separate **Info.plist** file (in the above example, it's **ios/myapp copy-Info.plist**). To simplify your project we recommend using the same file for all targets:
279
280- Delete **./ios/myapp copy-Info.plist**.
281- Click on the new target.
282- Go to `Build Settings` tab.
283- Find `Packaging` section.
284- Change **Info.plist** value - **myapp copy-Info.plist** -> **myapp/Info.plist**.
285- Change `Product Bundle Identifier`.
286
287<ImageSpotlight
288  alt="Xcode build settings"
289  src="/static/images/eas-build/variants/3-target-build-settings.png"
290  style={{ maxWidth: 720 }}
291/>
292
293To change the display name:
294
295- Open **Info.plist** and add key `Bundle display name` with value `$(DISPLAY_NAME)`.
296- Open `Build Settings` for both targets and find `User-Defined` section.
297- Add key `DISPLAY_NAME` with the name you want to use for that target.
298
299To change the app icon:
300
301- Create a new image set (you can create it from the existing image set for the current icon, it's usually named `AppIcon`)
302- Open `Build Settings` for the target that you want to change icon.
303- Find `Asset Catalog Compiler - Options` section.
304- Change `Primary App Icon Set Name` to the name of the new image set.
305