I'm using Google Maps v2 API in my project. In Google Maps v2 the debug/release API key is defined in AndroidManifest.xml
. I have seen the link but in that map key is defined in a xml layout file not in AndroidManifest.xml
. So can I define both debug and release keys for my project in AndroidManifest.xml
?
I want something like this in AndroidManifest.xml
:
If debug mode:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/debug_map_api_key"/>
If release mode:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/release_map_api_key"/>
I solved this issue using this steps:
In Google Developer API Console
keytool -list -v -keystore mystore.keystore
android
SHA1 key;package name
for debug and press enterSHA1 key;package name
for release Now use this API key your project
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/common_map_api_key"/>