Ensure that the “Google Maps Android API v2” is en

2019-01-11 11:01发布

I am working on google maps and I am getting this error. I had done the following things:

  1. Got My sha1 fingerprint.

  2. Registered my project and got my project key.

I don't know to how to get Google Maps Android API v2 enable because all the links I have tried are old and Google had changed it's site design. Please help me. I already have wasted a lot of time on this.

My Logcat:

enter image description here

Authorization failure.  Please see developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API: In the Google Developer Console (console.developers.google.com)


 Ensure that the "Google Maps Android API v2" is enabled.
 Ensure that the following Android Key exists:
   API Key: AIzaSyBK8rKr9lCRLhzv68I4Q26G9pHHO******

7条回答
贼婆χ
2楼-- · 2019-01-11 11:22

you may need to add new SHA-1 Certificate fingerprints to your API key application restrictions page: enter image description here

to generate a SHA1 Certificate fingerprints for your debug build, use keytool of java jre as the following example command:

C:\Program Files\Android\Android Studio\jre\bin>keytool -list -v -keystore C:\Users\linhd\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
查看更多
ゆ 、 Hurt°
3楼-- · 2019-01-11 11:29

I added a key from another test project to a main. Then I opened https://console.developers.google.com/ and added that key with a new application name (like Linh Dao wrote), but it didn't help.

Then I added a new activity (a template "Google Maps Activity" in a gallery) and opened a file google_maps_api.xml. From there I again found a link like https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=06:F2:F4:CD...applicationName.

I opened app/build.gradle, found applicationId value with applicationIdSuffix, if exists, and joined, for instance into com.example.myapp.debug. In the link I changed an applicationName to this new value and opened the link.

Again created a new project, generated a new key and edited it, wrote package name and SHA-1 fingerprint, like @Linh Dao wrote. Then saved. If you later with to find that key, find your project in Google console and open credentials.

I deleted an unnecessary map activity and in AndroidManifest retained

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

in application tag.

查看更多
啃猪蹄的小仙女
4楼-- · 2019-01-11 11:33

Actually i had the same problem as well. my application runs and the map is blank!

actually i had the problem in API Key restrictions


Google Developer Console

  1. Login to Developer Console.
  2. In your Dashboard Navigation Menu.(left side)
  3. Select API & Services > Credentials.
  4. So you will be redirected to Credentials page were you can view all the API keys that you created (https://console.cloud.google.com/apis/credentials)
  5. Identify your Project API key and click on Edit Api Key.
  6. Under that you can see the Key restrictions
  7. From there remover all Application restrictions and Api restriction.

On your Android Mobile

  1. Uninstall the App.

Android Studio

  1. Build > Clean Project.
  2. Build > Rebild Project.
  3. Run IT

This steps worked for me perfectly.

查看更多
Ridiculous、
5楼-- · 2019-01-11 11:36

From error it is clear that You did not enable google map api for android. To enable,

  1. Login google developer console
  2. Select Library option from left side panel.
  3. Now you can see all API list and go to Google Maps APIs and select Google Maps Android API .
  4. Now you can see option to enable/disable API. Enable it.

I hope it help you.

查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-01-11 11:42

This may happen when the package name is incorrect in the console credential section for development and production make sure your package name is correct. In my case, the package name was wrong when I corrected it map become visible

查看更多
女痞
7楼-- · 2019-01-11 11:42

In Android Error show its self mistake.

In Your Error Its show error to check first V2 google map API is ON in google developer Console.

just open google developer console and you just have to on this API and some configuration need have to do there for access map.

you can see process and more details from here.

Working With V2 Google Map

查看更多
登录 后发表回答