@Kushal Billaiya's solution didn't work for me, as it overrides existing manifestPlaceholders. What I did instead was the following:
First, still set your Google Maps API Key as an environment variable named MAPS_API_KEY
. I do this via the run configuration, but other ways exist.
Then in the android/app/build.gradle
file (Important: There are 2 build.gradle files. You want the one inside the android > app folder), add one line to the defaultConfig:
defaultConfig {
...
manifestPlaceholders["mapsApiKey"] = "$System.env.MAPS_API_KEY"
}
And in the android/app/src/main/AndroidManifest.xml
file, you can add this line inside the <application> tag:
<meta-data android:name="com.google.android.geo.API_KEY" android:value="${mapsApiKey}"/>