hanabi1224 / flutter_appcenter_bundle

MIT License
21 stars 48 forks source link

How to use product flavors to disable distribute on Play Store builds? #27

Closed rockgecko-development closed 3 years ago

rockgecko-development commented 3 years ago

Could the documentation please be updated, as I'm not sure how to use this? I'm familiar with flavors in projects, but unsure how to refer to ones defined in libraries - or how to use it with my app's existing flavors. Here's my current build.gradle:

flavorDimensions "app"
    productFlavors{
        dev{
            dimension "app"
            signingConfig signingConfigs.dev
            applicationId "com.myapp.dev"            
        }
        uat{
            dimension "app"
            signingConfig signingConfigs.uat
            applicationId "com.myapp.uat"            
        }
        prod{
            dimension "app"
            signingConfig signingConfigs.prod
            applicationId "com.myapp"            
        }
    }

I have flutter build apk --flavor $BUILD_FLAVOR --$BUILD_TYPE in my appcenter-post-clone.sh. I have 3 different builds configured in appcenter, and pass in a different BUILD_FLAVOR environment variable for each.

I'm just unsure how to add this other dimension.

_Originally posted by @rockgecko-development in https://github.com/hanabi1224/flutter_appcenter_bundle/issues/23#issuecomment-769476258_

Mardaneus86 commented 3 years ago

It looks like you are required to have a googlePlay flavor, and the flavorDimension needs to be distribute in order for this to work. Would like to know if there is a possibility to not enforce this specific configuration from consumers of the library.

hanabi1224 commented 3 years ago

Please check updated readme

mikeesouth commented 3 years ago

I'm also interested in this. @hanabi1224 I still don't understand, even after reading the updated readme. Given the config posted by @rockgecko-development, how would those flavors merge with the required flavors for appcenter regarding distribute?

Like this? I guess something like this wouldn't even be valid and even if would, the distribute flavor dimension would not have any effect if the "prod" flavor is built, right?

flavorDimensions "app"
    productFlavors{
        dev{
            dimension "app"
            signingConfig signingConfigs.dev
            applicationId "com.myapp.dev"            
        }
        uat{
            dimension "app"
            signingConfig signingConfigs.uat
            applicationId "com.myapp.uat"            
        }
        prod{
            dimension "app"
            signingConfig signingConfigs.prod
            applicationId "com.myapp"            
        }
    }

  flavorDimensions "distribute"
  productFlavors {
      appCenter {
          dimension "distribute"
      }

      googlePlay {
          dimension "distribute"
      }
  }
hanabi1224 commented 3 years ago

Dimensions are orthogonal. Please refer to this article on multiple dimensions

mikeesouth commented 3 years ago

I see, thanks for the link!

joao10martins commented 3 years ago

Were you able to submit your app successfuly on GooglePlay Console? If yes, how did you do it?