Appcenter: [Feature] Support for multiple flavor dimensions

Created on 5 Feb 2019  路  39Comments  路  Source: microsoft/appcenter

At the moment App Center does not support multiple flavor dimensions (Android). We only get the cross product of each flavor + build type but not the cross product of flavors belonging to different dimensions + build type. Please add this feature to ensure we get the same build variants like in Android Studio.

build feature request keep reviewed-DRI

Most helpful comment

@harry248 thanks for this feature request! We'll leave this issue open to track overall support for this.

All 39 comments

@harry248 thanks for this feature request! We'll leave this issue open to track overall support for this.

Referencing #50

I'm very keen to have this working as I can't really use the tool without it

@nrajpurkar Is there an update on this? Is it something being worked on?

@IanField90 no update to share at the moment. Our current work for the month can be seen in our Iteration Plan, and we weren't able to get to this in April.

any plans to add this to the may Iteration Plan? Or anytime soon?
We can't migrate to appcenter without multiple flavor dimensions

How is it possible that this feature is not implemented yet? There are are so many apps thats using multiple dimensions and they cannot be build yet.

Same here. Migrating to appcenter without multiple flavors is just not possible for us.

Unfortunately, this did not make it into the May iteration plan as we're focusing on two other areas for Build. We'll continue to consider this feature request as we prioritize work for following iteration plans.

Same here. I hear that it's not in the May iteration plan and still seems a rather crucial basic feature. Like others here, migrating to AppCenter without multiple flavors is just not possible for us. Is there a June plan?

We have not landed on the full June iteration plan yet, but we will definitely take this feature request into account as we are deciding June's priorities.

I have been using AppCenter for almost since the start, but now our several apps are using flavors and dimensions, and we got no option except to look for some other alternative for CI/CD. Can you please make this on urgent basis as we don't want to leave AppCenter. We love it a lot.

We were so excited when we heard about App Center. Unfortunately our project uses multiple flavor dimensions and, sadly enough, we aren't able to continue with App Center for now.

While we are waiting for proper support, there is a rather easy way around it.

You can declare your flavors conditionally in build.gradle and set ENV variables in AppCenter to identify which flavors to build.

A bit simplified, you can set up the following logic:

if (!isAppcenter) {
  // All flavors, lets you build them locally as expected
}

if (isAppcenter && isFlavorA {
  // Only flavor A stuff
}

if (isAppcenter && isFlavorB {
  // Only flavor B stuff
}

From there, you can either set up each flavor as a separate app in AppCenter, or build them from separate branches in the same app depending on your deployment preferences.

We'd love to have support for this.

We'd love this also (need), thanks

It's a very important function for our products before moving to App Center! Hope it could be planned early!

Support for this is quite urgent for us, please prioritise this @nrajpurkar !

This is a very important function. I'd like it to be
developed soon!

Not sure if there's a proper way to up-vote requests, so I'll just add a "me too" to this as well.

Noted @darrentaft! We take a look at the reactions and comments (total engagement) on an issue when prioritizing upcoming work.

I need this feature too.. How long will it take??

@nrajpurkar will it land in November iteration plan?
We need this feature to migrate to AppCenter.
Thanks

@nrajpurkar How is this looking in terms of priority?

@Zee-day unfortunately this didn't make the cut for November's plan. As you can see on this month's plan, the team is focused on tackling HockeyApp gaps as we near HockeyApp shutdown. We'll continue to track this item for when we have some more bandwidth for Build improvements.

My Workaround

I use two flavor dimensions in my app: "appType" for different target users of the app, and "endpoint" to choose which server to connect to. I was able to modify my build.gradle file to look for the endpoint flavor via an environment variable, and then use a single flavor dimension if that environment variable is present. Once this was done, I was able to build in App Center using the single flavor and an environment variable. It had to make three changes: (1) set build config variables by looping through variants rather than using productFlavors block (2) adjust source set for variants using environment variable (3) copy google-services.json to correct location because the google plug-in ignores the source set configuration. My builds in Android Studio are not affected, so it is a very amenable set up. Here is my build.gradle file.

I'll chime in as well -- This is an extremely important feature of any continuous integration/delivery system. It is particularly important to me with respect to iOS builds. Since I must make the build a 'debug' build in order to have my UI tests run, I need to also be able to create a release build (with its own certificate/provisioning profile), and that is what I'd like to be distributing to beta testers (and ultimately, the app store).

Pretty please with sugar on top? =)

In app build.gradle:

android {
...
    flavorDimensions "version"
    productFlavors {
        dev {
            dimension "version"
            applicationIdSuffix = ".dev"
            versionNameSuffix "-dev"
            resValue "string", "app_name", "My app dev"
        }
        prod {
            dimension "version"
            resValue "string", "app_name", "My app"
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            def type = variant.buildType.name
            def flavor = variant.productFlavors[0].name
            output.outputFileName = "app-${flavor}-${type}.apk"
        }
    }
...
}

This will create an APK file with the format app-prod-release.apk (look below)

In appcenter-post-clone.sh replace the last three lines with this:

flutter build apk --release --flavor prod

#copy the APK where AppCenter will find it
mkdir -p android/app/build/outputs/apk/; mv build/app/outputs/apk/prod/release/app-prod-release.apk $_

In this case your flavor is prod and you're building a release.

@hnilsen Your example only has a single flavor dimension (with 2 flavors for it). This issue is regarding apps that have MULTIPLE flavor dimensions. e.g.

android {
    ...
    flavorDimensions "version", "colour"
    productFlavors {
        dev {
            dimension "version"
            applicationIdSuffix = ".dev"
            versionNameSuffix "-dev"
            resValue "string", "app_name", "My app dev"
        }
        prod {
            dimension "version"
            resValue "string", "app_name", "My app"
        }
        green {
            dimension "colour"
            resValue "string", "app_colour", "Green"
        }
        red {
            dimension "colour"
            resValue "string", "app_colour", "Red"
        }
    }
    ...
}

For this, there could be devGreen, devRed, prodGreen, prodRed flavors, each with debug/release build types. AppCenter doesn't currently support this, which is what this request is for.

Right, thank you for clearing that up for me @darrentaft - I still hope someone gets some use out of my comment if they struggle with just a one-dimensional flavor :-)

That's indeed a big problem that makes AppCenter almost unusable as soon as we have more than 1 dimension... it's been more than a year and the feature is still not available and not planned. Is there any news for an approximate date of when it will be available? That would be SO usefull! Thanks!

There is a workaround.

Waiting for this?

All feature development on AppCenter has been suspended indefinitely. It's dead. Go find another service. I went back to CircleCI, sadly. I like AppCenter way better.

All feature development on AppCenter has been suspended indefinitely. It's dead. Go find another service. I went back to CircleCI, sadly. I like AppCenter way better.

I hope it's not dead... Microsoft is saying that they are putting most new feature development on indefinite hold, as @phatmann said, but so far they are also saying that this is to work on stability & performance. Hopefully that is accurate.

Well, it is at least comatose 馃槈 Way too many missing features and issues to make it usable, and no fixes on the horizon. And honestly, I don't think that they will ever be fixed -- the timeline in the above post should be taken with a grain of salt. I am guessing the whole team was disbanded and moved to Azure.

Adding a +1 here so I get notified if there is ever any movement on this request. Sad that after 2 years nothing has been done about it, but I suppose that is how things go on free platforms.

Very unlikely that this will get implemented, but I am amazed that it was omitted in the first place.

I also cannot believe multiple flavour dimensions are not supported. This is pretty fundamental stuff and is needed for many apps.

I worked around this lack of support by creating a gradle Copy task with a name that matches what I could choose in the "build variant" dropdown in the GUI. Then making this task depend on an actual (multiple dimensions) product flavor and copying its outputs:

// only example values, I populate these from env variables:
def assembleTaskAliasName="flavourRelease" // whatever "build variant" you are able to select in the Build Configuration web GUI
def assembleTaskAliasVariant="productionFlavourRelease" // an actual flavor (can contain multiple dimensions)

applicationVariants.all { variant ->    
    if (assembleTaskAliasName != ""
            && assembleTaskAliasVariant != ""
            && variant.name == assembleTaskAliasVariant) {
        println("Creating alias $assembleTaskAliasName for $assembleTaskAliasVariant")
        def aliasTaskName = "assemble${assembleTaskAliasName.capitalize()}"
        def aliasTask = task(aliasTaskName, type: Copy) {
            from variant.outputs*.outputFile.toSet()
            into "build/outputs/apk/$assembleTaskAliasName"
        }
        variant.assemble.finalizedBy aliasTask
        aliasTask.dependsOn variant.assemble
    }
}

This strategy can also be adapted to build more than one application variant at once.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chriskellor picture chriskellor  路  3Comments

comply365dev picture comply365dev  路  4Comments

thabemmz picture thabemmz  路  3Comments

Oddj0b picture Oddj0b  路  3Comments

DouglasMarq picture DouglasMarq  路  4Comments