If you already have the key got the link below and add the fingerprint along with your android project package name

You also need to login to your google account

https://code.google.com/apis/console

Click on create new key. Add the fingerprint along with your android project package name.

You can see the api key above

Enable google map api v2 from services tab.

Then in manifest file under application tag

 <meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my key"/>
Answer from Raghunandan on Stack Overflow
🌐
Google
developers.google.com › google maps platform › android › maps sdk for android › set up the maps sdk for android
Set up the Maps SDK for Android | Google for Developers
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-12-18 UTC."],[],["To use the Maps SDK, you need an API key, created via the Google Cloud Console or Cloud SDK.
🌐
Google
developers.google.com › google maps platform › web › maps embed api › set up the maps embed api
Set up the Maps Embed API | Google for Developers
To create one, go to the Google Maps Platform Credentials page and select \"Create credentials\" then \"API key.\" Restrict your key via the Credentials page, selecting \"HTTP referrers\" for application restrictions and choosing specific APIs ...
🌐
Alphatech
alphatech.technology › Howto-Entry-srk › How-to-Google-Maps-API-Key-bek
How to obtain a Google Maps API Key
To use the Google Maps functionality in Android, you need to register for a Maps API key with Google. Until you do this, you will just see a blank grid instead of a map in your applications. You must obtain a Google Maps Android API v2 key.
🌐
GeeksforGeeks
geeksforgeeks.org › android › how-to-generate-api-key-for-using-google-maps-in-android
How to Generate API Key for Using Google Maps in Android? - GeeksforGeeks
July 23, 2025 - Now you can use this API for using maps. But this key is used by anyone in any of the projects. So we have to restrict the API key for our own project so that anyone cannot use this API key inside their app. ... To restrict your API click on Restrict key option. After clicking on this option you will get to see the below screen. Inside this screen click on Android apps and click on Add an item option and after that, you will get to see the below screen.
🌐
Reddit
reddit.com › r/androiddev › how to secure google map api key
r/androiddev on Reddit: How to secure google map api key
October 16, 2024 -

As far as i ve checked, the api key should be in android manifest which will be used by the MapView that we are using in the app. But the problem is if i decompile my app, i can see my api key in the manifest.

I even checked the apk (cloned the repo found in android documentation website itself which has the example on implementing maps in project), its the same.

How to secure it? I saw that we can use google console and we can restrict the use of api, but still the api should be set in manifest and still it can be decompiled and misused. How to solve this?

🌐
Appunite
tech.appunite.com › posts › how-to-securely-use-google-maps-api-key-in-android-i-os-or-flutter-project
How to securely use Google Maps API Key in Android, iOS, or Flutter Project | Appunite Tech Blog
According to Google Documentation to store API keys securely it is recommended to use local properties. If you don’t have the file local.properties in your project, it should be located in the android project root directory. Make sure to add it to intentionally untracked files in your version control tool. Now you can add here a new variable. Note that the value of the key should NOT be wrapped by either single or double quote characters. googleMapsApiKey=YOUR_GOOGLE_MAPS_API_KEY_STRING_VALUE
🌐
Reddit
reddit.com › r/androiddev › using google maps on android: do we really need to have to insert the api key inside the android manifest? is that dangerous? how to protect yourself?
r/androiddev on Reddit: Using google maps on android: Do we really need to have to insert the API key inside the android Manifest? Is that dangerous? How to protect yourself?
March 17, 2025 -

Hello, I am about to use for the first time the google map api for android,

And apparently in order to display the app in your app context, you need to have the API key defined in the android manifest like this:

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="YOUR_API_KEY_HERE"/>
  • Isn't there any other way?

  • Isn't that dangerous? People can get your api key.

  • I read about restricting the api to your app, but is that enough? Are there bad stories about people who had a misadventure of missused map APIs? Despite restricting?

  • What other solutions to protect yourself from your API key abuse?

Find elsewhere
🌐
Embarcadero
docwiki.embarcadero.com › RADStudio › Sydney › en › Configuring_Android_Applications_to_Use_Google_Maps
Configuring Android Applications to Use Google Maps - RAD Studio
Click Create. Google API Console displays the API key window with a forty-character API key, for example: API key: AIzaSyCMuJ2w8_gQEedvqUg-9lxWXFg7feAl9PQ · For your Android application to access Google Maps, ensure that you have configured the following project options and permissions:
🌐
DEV Community
dev.to › paulfranco › securing-and-injecting-google-maps-api-key-in-an-android-app-14kp
Securing and Injecting Google Maps API Key in an Android App - DEV Community
March 3, 2025 - GOOGLE_MAP_API_KEY=your_actual_google_maps_api_key · Add secrets.properties to .gitignore to ensure it is not committed to the repository: ... Now, the API key is stored securely and will not be pushed to GitHub or shared in version control. Since we need to use this API key within Gradle, we need to load it from secrets.properties. Modify the build.gradle.kts file and add the following snippet before the android block:
Top answer
1 of 8
9

I recommend a simpler approach that involves taking advantage of an unlikely, but more specific asset folder to house your debug key. To set this up, create a file res/values/maps-apikey.xml with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="maps_apikey">[productionApiKey]</string>
</resources>

Then each developer locally will add a file derived from this one in res/values-v1/maps-apikey.xml where their debug API key is provided. At runtime, the Android system will favor the more specific version res/values-v1/maps-apikey.xml for all versions of Android (since all are at least on API level 1 or higher).

Source control systems like git and svn allow you to add an "ignore" file which directs the tools to ignore this res/values-v1/maps-apikey.xml file so that each developer does not accidentally commit it to the repository. To do this for git, simply add a file res/.gitignore which contains only the line values-v1 then commit this file.

To release your software, simply delete the res/values-v1/maps-apikey.xml file before exporting a release. The resulting APK will then reference the version in res/values/maps-apikey.xml which is your correct production key.

2 of 8
3

you are doing the right thing but not the right way I think. Declare your string in strings.xml like this :

<string name="googleMapsAPIKey">TheMagicKeyString</string>
<!-- You can add this at the end as comment to keep a copy of another key for instance, to exchange it between debug and production-->

Note that you didn't give the same name at your 2 strings... One is called debug and not the other.

🌐
Kony
docs.kony.com › docs › visualizer › visualizer_user_guide › Content › Generating_Map_Keys.htm
Generating and Configuring Map API Keys
You will need Maps API Key for Maps to work in the applications you develop. You need to generate the Maps API key and specify it in the properties of the Map widget. You need to configure the following map keys for your application: ... Google Map key for Android (exclusive key for Android platform).
🌐
Vogella
vogella.com › tutorials › AndroidGoogleMaps › article.html
Google Maps Android API v2 - Tutorial
(See the file "res/values/google_maps_api.xml"). Note that the API key is linked to the encryption key used to sign the APK. You need a different API key for each encryption key, including the release key that is used to sign the APK for publishing. You can define the keys for the debug and ...
🌐
Set Compass
setcompass.com › How-to-Get-Google-Maps-API-Key-Guide.htm
How to get your Google Maps API key (Tutorial)
This tutorial provides a step-by-step guide for quickly obtaining a Google Maps API key.
🌐
Genexus
docs.genexus.com › en › wiki
HowTo: Get an API Key from Google | Article
This document explains how to get an API Key from Google and provides a brief overview about it · To use Google Maps in any compiled Android application, you must have an API Key from Google. Otherwise, maps will not be shown when using the Maps Control Type or Geolocation domain
🌐
Google
developers.google.com › google maps platform › android › maps sdk for android › maps sdk for android quickstart
Maps SDK for Android Quickstart | Google for Developers
Caution: The AndroidManifest.xml file contains instructions on getting a Google Maps API key and then adding it to your local.properties file. Do not add your API key to the local.properties file. Doing so stores your API key less securely.
🌐
Medium
emenaa.medium.com › create-maps-api-key-and-enable-maps-sdk-for-android-and-ios-270d0fac2672
Create Maps API Key and enable Maps SDK for Android and IOS | by Rodrigo Mena | Medium
January 15, 2021 - I wont go and restrict it because i wont be using it in a production app. Now to enable Maps SDK for Android and IOS in the navigation menu search for “Google Maps”, then select “Apis”.
🌐
Google Maps Platform
mapsplatform.google.com › resources › blog › google-maps-platform-best-practices-restricting-api-keys
Blog: Google Maps Platform best practices: Restricting API keys – Google Maps Platform
API keys are the primary way we authenticate access to Google Maps Platform APIs and SDKs. Here's a rundown on the key restrictions available, best practices, and a video tutorial on how to restrict your keys.