October 31, 2022
  • Announcements
  • Android
  • Appflow
  • iOS

iOS Schemes and Android Variants support now in Appflow

Cecelia Martinez

Developer Advocate

Appflow, the mobile DevOps platform from Ionic, is excited to introduce support for iOS Schemes and Android Variants. Leveraging Appflow’s Custom Environments feature, you can now specify custom build settings using the Schemes or Variants already defined for your mobile application project.

With support for iOS Schemes and Android Variants, Appflow gives you powerful functionality to customize your builds without the need to pass multiple environment variables or manually specify settings with build scripts.

Build versions for testing, demos, and more

iOS Schemes and Android Variants allow developers to define build targets, configurations, and variables in a build version for a specific purpose. For example:

  • A test build version that does not load ads and uses mock data
  • A demo build version that excludes premium features
  • A legacy build version for older devices that excludes unsupported functionality
  • A debug build version that allows for debugger attachment

Appflow has added new environment variables to custom environments so developers can set an iOS Scheme or Android Variant for a given environment.

Custom Environments for all

To allow all developers to use the new Schemes and Variants support, all Appflow plans now have access to Custom Environments! Previously, only Basic plans and above had this feature.

Plans have been updated with the following custom environment availability:

  • Community: Up to 3 environments
  • Startup: Up to 5 environments
  • Basic: Up to 10 environments
  • Standard: Up to 100 environments
  • Enterprise: Customized environment limit

iOS Schemes

iOS build schemes let you configure build targets, configuration, and environment details. Check out the Apple documentation for details on how to create and customize a scheme.

Appflow will attempt to automatically detect which scheme to use for your build, but you can now also specify a scheme for a custom environment using the IOS_SCHEME environment variable.

Appflow Environment creation screen with Custom iOS Scheme as the name and IOS_SCHEME as a key with a value of CustomScheme

Android Variants

Android’s build variants are composed of a Build Type and a Flavor. For example, a build type of debug and a flavor of demo would combine to create a debugDemo build variant.

Build Types and Flavors are both customized in your app’s module-level build.gradle configuration file.

Build Types

By default, Appflow provides Debug and Release build types for Android. You can define a custom build type in the android block to specify build and packaging settings. The Android documentation outlines which options are available.

Example:

android {
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        beta {
            minifyEnabled true
            applicationIdSuffix ".beta"
            debuggable true
        }
    }
}

 

Then in Appflow, use the ANDROID_BUILD_TYPE environment variable and pass the value of which build type to use for a custom environment. Read more in the Appflow documentation here.

Appflow environment creation screen with Custom Android Variant name and BUILD_TYPE as a key with Staging as the value.

Flavors

Android product flavors let you customize any property in defaultConfig and create source sets to control which code is used for a given flavor. Flavors are also defined inside the android block under productFlavors. A flavorDimension, which represents a group of flavors, is also required.

Example:

android {
    ...
    flavorDimensions "version"
    productFlavors {
        internal {
            applicationIdSuffix ".internal"
            versionNameSuffix "-internal"
        }
        public {
            applicationIdSuffix ".public"
            versionNameSuffix "-public"
        }
    }
}

 

Note: Appflow currently only supports a single flavor dimension. See documentation for more details.

In Appflow, use the ANDROID_FLAVOR environment variable to set the flavor for a custom environment.

Using Custom Environments

Once you have created a custom environment, select it when creating a new build or use an Appflow automation to always use a specific environment based on a trigger. It’s that simple.

Appflow New Build screen with Android devDebug Build Variant selected in the Environment selection.

Get started

Create your own Custom Environments with iOS Schemes and Android Variants today in the Automate section of your project or from the build screen.

To leverage Appflow for streamlined mobile builds and deployments, start a free trial today.


Cecelia Martinez

Developer Advocate