skip to Main Content

I am trying to create a google map activity in android studio, but the file google_maps_api.xml was not created in the res/values folder (see screenshot). Am I missing something or can I just create the file myself?

o I tried to research why this might happen, but I was unable to determine why google_maps_api.xml would not be created automatically.

2

Answers


  1. I suppose that google_maps_api.xml is just a file with some resources such as strings or integers. So you can just manually add it by yourself in the res/values folder in your module. And after that add any resources (API keys or something else) in this file.

    Login or Signup to reply.
  2. Android Studio underwent some modifications a while back and stopped creating the google_maps_api.xml file automatically. You need to do two things instead:

    1. Open the project’s local.properties file and add the line MAPS_API_KEY=YOUR_KEY_HERE, replacing YOUR_KEY_HERE with your API key.

    2. Open AndroidManifest.xml file and replace YOUR_API_KEY with ${MAPS_API_KEY} as shown below.

    <application ...>
    
           <meta-data
               android:name="com.google.android.geo.API_KEY"
               android:value="${MAPS_API_KEY}" />
           
           <activity ...>
              ...
           </activity>
       </application>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search