Grigori Rasputin
Grigori Rasputin

Reputation: 51

Android Studio Google Maps Key

SOS,

I am working on an Android project that entails using the Google Maps API. I have generated a key with the proper restrictions but I cannot get my program to run. The error I am getting is:

Error:(53, 28) No resource found that matches the given name (at 'value' with value '@string/google_maps_key').

I did some research and found that I needed to change @string/google_maps_key to my actual key. See the example below. Take note of the fact the tags are emitted.

Before:

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

After:

meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyBY3c7RFvwzs06juEg0nzIU7PVERTIV3U8" /

I attempted to make the changes shown but when I run my program is automatically changes it back to @string/google_maps_key.

What must I do to get my mapping application up and running? Thank you in advance to anybody with helpful input.

Upvotes: 3

Views: 10787

Answers (1)

Nishant Dubey
Nishant Dubey

Reputation: 2872

All you need to do is navigate to - res/values/strings.xml in your android app project and change your file to something like this:

Under <resources> you may have many more strings just add the one shown here too and it will work.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="google_maps_key">AIzaSyBY3c7RFvwzs06juEg0nzIU7PVERTIV3U8</string>
</resources>

Upvotes: 9

Related Questions