How do we locate the google_maps_api.xml file

14,460

Solution 1

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

Solution 2

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

Solution 3

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"/>

Solution 4

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

Share:
14,460
JayVDiyk
Author by

JayVDiyk

Updated on June 08, 2022

Comments

  • JayVDiyk
    JayVDiyk almost 2 years

    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?