play-services-plugins
play-services-plugins copied to clipboard
File google-services.json is missing. Plugin did not search in all flavor locations.
Describe the bug Issue is that plugin can't find google-services.json, but in the list of search locations I don't see some of the source sets for specific flavor in multi flavor project.
So to give an example. Let's say I have this build variant: flavorTest/release.
These are the searched locations:
Actual behaviour "src/release", "src/flavorRelease", "src/flavor", "src/flavor/release", "src/release/flavorTest", "src/flavorTest", "src/flavorTestRelease", "src/flavor/test/release", "src/flavor/testRelease"
Expected behaviour "src/flavorTest/release", "src/release/flavorTest", "src/flavor/release", "src/test/release", "src/flavorTest", "src/release", "src/flavorTestRelease", "src/flavor", "src/flavorRelease", "src/test", "src/testRelease"
Desktop (please complete the following information):
- Gradle version: 4.8.1
- Android Studio version: 3.3 RC1
- Plugin name and version: com.google.gms:google-services:4.2.0
Context Second flavor dimension alone is missing from search locations, so it is impossible to use it to store google-services.json.
Because there is no limit on the number of flavor dimensions which can exist, it would get very computationally difficult to traverse all combinations of all flavors in all dimensions. Therefore, for now, we traverse the flavor dimensions linearly in the order they are listed. If you put the flavor dimensions in order: Most general to least general, then you will get the configuration results you are looking for.
Thank you for explanation.
Then I would argue that it shouldn't be from most general to least general, but rather from least general to most general because this is how the priority is assigned in Android Gradle plugin (from highest to lowest).
In other words, I would say that you want to override the most general by least general (more specific) and in Android Gradle plugin you can only do that by having the least general first followed by the most general.
I also noticed this. I have two flavour dimensions, "tester" and "environment" in that order.
What I notice from the trawled directories is that environment
directories are not trawled on their own. For example, src/develop
. Only src/oneDevelop
is searched . This means that if I have a different services JSON for each environment, I have to duplicate it across each variant rather than just placing one in each environment
directory
Thank you for explanation.
Then I would argue that it shouldn't be from most general to least general, but rather from least general to most general because this is how the priority is assigned in Android Gradle plugin (from highest to lowest).
In other words, I would say that you want to override the most general by least general (more specific) and in Android Gradle plugin you can only do that by having the least general first followed by the most general.
I agree with that point. Just checked 4.3.2 version and got next locations order:
- src/simpleFreeGoogle
- src/release
- src/simpleFreeGoogleRelease
- src/simple
- src/simpleRelease
- src/simpleFreeGoogle/release
- src/release/simpleFreeGoogle
- src/simple/release
- src/simple/free
- src/simple/freeRelease
- src/simple/free/release
- src/simple/free/google
- src/simple/free/googleRelease
- src/simple/free/google/release
Now list sorted ascending by slash count. Seems we have to reverse it.