play-services-plugins icon indicating copy to clipboard operation
play-services-plugins copied to clipboard

Google services plugin: Exclude flavors or build types

Open saschpe opened this issue 6 years ago • 1 comments

Describe the bug The current Google services plugin follows an all or nothing approach, all configured product flavors and build types with unique applicationId have to be present in google-services.json.

To Reproduce It is common to use a custom application ID for the debug flavor to allow for parallel installation with (published) release builds (Gradle Kotlin DSL):

android {    
    buildTypes {
        named("debug") {
            applicationIdSuffix = ".debug" // Allow installation in parallel to release builds
        }
        named("release") {
          // ...
        }
    }
    // ...
}

Yet, the plugin requires this application ID to be present in google-services.json. The same is true for any other flavor not meant for publishing to the Play Store (think free or amazon flavors). The annoyance gets worse when Firebase is involved as it captures and displays statistics for all those registered application Ids. Asumming I have a play and amazon product flavor and use an application ID suffix for debug builds, I end up having to maintain four entries in google-services.json leading to a mess on Firebase where I only wanted to have exactly one entry (i.e. the play-release build).

Expected behavior The plugin provides a Gradle configuration clause that allows to configure the plugin, for example:

googleServices {
   applicationIds = ["the.one.i.care.about"]
   // other stuff..
}

Desktop (please complete the following information):

  • Gradle version: 5.6.0
  • Android Studio version: 3.5 (stable)
  • Plugin name and version: Google Services 4.3.2

Additional context Add any other context about the problem here.

saschpe avatar Sep 10 '19 12:09 saschpe

Or just be like Fabric and dynamically add any apps with different suffix so we don't have to keep adding to the Json file.

saadfarooq avatar Mar 31 '20 01:03 saadfarooq