google-services.json not found in flavor/build-type directories when using flavors with capital first letter
See original GitHub issueWith 4.2.0 of the plugin the google-services.json was also searched in subdirectories flavor/build-type when the flavor starts with a capital letter. With 4.3.2 it is only searched in the lower-cased version of the flavor.
To Reproduce Steps to reproduce the behavior:
- Put google-services.json into a subdirectory
<flavor>/<build-type>
where<flavor>
starts with an uppercase character. ./gradlew :app:process<flavor><build-type>GoogleServices
Expected behavior Compile succeeds
Screenshots File google-services.json is missing. The Google Services Plugin cannot function without it. Searched Location: /home/kurt/ [REDACTED]/app/google-services.json
Desktop (please complete the following information):
- Gradle version: 5.6.1
- Android Studio version: n/a
- working Plugin name and version: com.google.gms:google-services:4.2.0
- failing Plugin name and version: com.google.gms:google-services:4.3.2 (as well as 4.3.0)
Additional context Description how to use flavor-specific google-services.json: https://stackoverflow.com/questions/30772201/google-services-json-for-different-productflavors https://android.jlelse.eu/how-to-use-different-google-services-json-file-with-multiple-product-flavors-android-7853d98dd6c0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:13
Top GitHub Comments
Our app has two flavor dimensions:
distribution_channel
(with 2 flavors:googlePlay
andappCenter
) andregion
(with 3 flavors:europe
,asia
,americas
). The plugin really fails to detect source folders of the flavors and tries to search in a weird locations instead:As you can see the plugin doesn’t search in
app/src/googlePlay
orapp/src/googlePlayRelease
folders, but for some weird reason searches in a location likeapp/src/europe/google/play/release
🤷♂️Just lost a fair amount of time to this problem. The debug output is almost useless as the getJsonLocations method dies right at the beginning resulting in a default search location and useless error message. Its particularly terrible when your project is working perfectly, and then after some configuration the whole thing fails to compile properly. After trial and error you discover is because you gave your flavor name a capital first letter.
I think what would be the best for this plugin is some sort of configuration block so that you could specify the location of the google services in one of the flavors. Not sure if gradle is capable of this but on a cursory peek at https://docs.gradle.org/current/userguide/custom_plugins.html it would seem it is possible to do direct configuration.
Could a direct configuration obliterate much of the confusion about the location of google-services.json?