Lahiru Chandima
Lahiru Chandima

Reputation: 24068

Incorrect google-services.json is picked by com.google.gms:google-services:4.3.4

My android app uses two firebase projects, one for development, and the other for the production.

I have placed the google-services.json of each firebase project in following directories.

Debug config: <app_root>/app/google-services.json

Prod config: <app_root>/app/src/release/google-services.json

I was using com.google.gms:google-services:4.3.2 and this setup worked fine. When I am developing, the config at <app_root>/app/google-services.json was used and when generating a signed release bundle, the config at <app_root>/app/src/release/google-services.json was picked automatically by Android Studio.

I upgraded google-services version to 4.3.4 today, and it seems <app_root>/app/src/release/google-services.json is not picked when doing a signed release bundle build. It uses <app_root>/app/google-services.json instead.

Why is this? Can this be a bug in com.google.gms:google-services:4.3.2? or overriding configs at build types directory is not supported anymore?

Upvotes: 2

Views: 678

Answers (2)

Lahiru Chandima
Lahiru Chandima

Reputation: 24068

Looks like com.google.gms:google-services:4.3.4 has changed the precedence of files, so that the google-services.json at <app_root>/app/google-services.json gets precedence over <app_root>/app/src/release/google-services.json, which was the other way around in version 4.3.2.

I moved <app_root>/app/google-services.json to <app_root>/app/src/debug/google-services.json, which gives me the previous behavior.

Upvotes: 4

MiDo
MiDo

Reputation: 121

I have the same issue with the <app_root>/app/src/debug/google-services.json by changing com.google.gms:google-services from 4.3.3 to 4.3.4. As a workarround I have moved the <app_root>/app/google-services.json to <app_root>/app/src/release/google-services.json and it works for me.

Upvotes: 2

Related Questions