JayVDiyk
JayVDiyk

Reputation: 4487

How do we locate the google_maps_api.xml file

Get a Google Maps API key

Your application needs an API key to access the Google Maps servers. The type of key you need is a Key for Android applications. The key is free. You can use it with any of your applications that call the Google Maps Android API, and it supports an unlimited number of users.

Choose one of the following ways to get your API key:

The fast, easy way: Use the link provided in the google_maps_api.xml file that Android Studio created for you:
    Copy the link provided in the google_maps_api.xml file and paste it into your browser. The link takes you to the Google

Developers Console and supplies information via URL parameters, thus reducing the manual input required from you. Follow the instructions to create a new project on the console or select an existing project. Create an Android API key for your console project. Copy the resulting API key, go back to Android Studio, and paste the API key into the element in the google_maps_api.xml file.

I am wondering how do we find that file. Where is it located?

Upvotes: 6

Views: 21596

Answers (4)

Manohar
Manohar

Reputation: 23404

For Debug build place key in

app > src > debug > res > values > google_maps_api.xml

and for Release build place key in

app > src > relese > res > values > google_maps_api.xml

enter image description here

You can also directly place it directly in strings.xml or in manifest

  <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key"/>

or

 <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="Aiza.._complete_your_key"/>

Upvotes: 5

Vrajesh
Vrajesh

Reputation: 1322

In Android Studio 3.0+ , When you sign apk, release and debug folder is not contain any google_maps_api.xml. i don't know why?

But you just simply put meta data in AndroidManifest.xml

   <meta-data
                android:name="com.google.android.geo.API_KEY"
                android:value="@string/API_KEY"/>

And properly sign your apk, - set package name - SHA1 key at Google Developer console (Here require Upload key and App signing key by google)

see my detail answer: https://stackoverflow.com/a/49692374/1978475

Upvotes: 6

natishka
natishka

Reputation: 566

Debug key: app > src > debug > res > values > google_maps_api.xml Release key : app > src > relese > res > values > google_maps_api.xml

Upvotes: 2

Akhi Prajapati
Akhi Prajapati

Reputation: 147

Go to res > values > google_maps_api.xml here you will find this

Upvotes: 5

Related Questions