When using multiple layers of product flavors, the default search locations for the JSONs are unable to find the service JSON; even if AGP recognizes these directories and automatically adds them to the sources. This disconnect between behaviors forces engineers to go against project resource conventions and create directories to satisfy this plugins expectations.
We want to store the NPD json in project/app/src/npd (this is a recognized source location for the variant in Android Studio, and probably should be in the default search locations).
Unfortunately, this results in an error:
* What went wrong:
Execution failed for task ':app:processAmazonNpdDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
project/app/src/amazon/npd/debug/google-services.json
project/app/src/amazonNpd/debug/google-services.json
project/app/src/debug/amazonNpd/google-services.json
project/app/src/amazon/debug/google-services.json
project/app/src/amazon/npd/google-services.json
project/app/src/amazon/npdDebug/google-services.json
project/app/src/amazonNpd/google-services.json
project/app/src/debug/google-services.json
project/app/src/amazonNpdDebug/google-services.json
project/app/src/amazon/google-services.json
project/app/src/amazonDebug/google-services.json
project/app/google-services.json
Suggested Solutions
Modify the default search locations to include a root directory for all flavors, regardless of priority.
Allow clients using the plugin to specify the location of the services JSON in the plugin's GoogleServicesPluginConfig. e.g.
When using multiple layers of product flavors, the default search locations for the JSONs are unable to find the service JSON; even if AGP recognizes these directories and automatically adds them to the sources. This disconnect between behaviors forces engineers to go against project resource conventions and create directories to satisfy this plugins expectations.
Here's a minimal example:
We want to store the NPD json in
project/app/src/npd
(this is a recognized source location for the variant in Android Studio, and probably should be in the default search locations).Unfortunately, this results in an error:
Suggested Solutions
GoogleServicesPluginConfig
. e.g.