I have an android app with four flavours.Each flavor has his its own google-services.json file.
This file needs to be under /app structure.I found this approach to be working in various links:
productFlavors{
one{
applicationId 'com.flavor.one'
versionName '2.4.3'
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
versionCode 26
copy {
from 'src/one/'
include '*.json'
into '.'
}
}
two{
applicationId 'com.flavor.two'
versionName '1.0.13'
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
versionCode 26
copy {
from 'src/two/'
include '*.json'
into '.'
}
}
three{
applicationId 'com.flavor.three'
versionName '1.4.1'
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
versionCode 5
copy {
from 'src/three/'
include '*.json'
into '.'
}
}
four{
applicationId 'com.flavor.four'
versionName '1.4.1'
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
versionCode 5
}
}
But this approach is always copying the last json to app directory.Not copying the flavor based json.