One of the easiest solutions. You can achieve this with two simple steps.
Add a custom value to the build.gradle manifest build.gradle . See below
buildTypes { debug { manifestPlaceholders = [ mapApiKeyValue:"GHjaSyAjlyp3O831lgaonHMXsd-_DpQ3002x3S4"] } release { manifestPlaceholders = [ mapApiKeyValue:"AIzaSyAuMGDLr2HeuRed4JA0CrdYYdZRjeC3EA"] } }
Edit the manifest file as shown below. part of my manifest file
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="${mapApiKeyValue}" />
This solution works for the latest Android 5.0 and Android 6.0 (API 20, 21,22,23)
Zumry Mohamed Nov 08 '16 at 10:17 2016-11-08 10:17
source share