I want to automatically set different android map api V2 keys for development and production.
One of the easiest solution.You can achieve it with two simple steps.
Add custom value to manifestplaceholders build.gradle
file.
See below
buildTypes {
debug {
manifestPlaceholders = [ mapApiKeyValue:"GHjaSyAjlyp3O831lgaonHMXsd-_DpQ3002x3S4"]
}
release {
manifestPlaceholders = [ mapApiKeyValue:"AIzaSyAuMGDLr2HeuRed4JA0CrdYYdZRjeC3EA"]
}
}
Edit manifest file like below. part of my manifest file
This solution works for the latest Android 5.0 and Android 6.0 (API 20, 21,22,23)