Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I found lots of questions regarding this - and I am almost ashamed to ask it myself.

But no matter how hard I try, I simple do not get the Maps API running at all!

Not with the demo project, com.example.mapdemo, not with my own project.

I definitely have my debug.keystore SHA1 fingerprint registered, now for both my app and com.example - I also tried the browser API key where everybody says that would work, too.

BUT NO.

I always get:

06-16 11:21:29.860: E/Google Maps Android API(2382): Authorization failure.  Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.

I am getting REALLY, REALLY mad at this. How is it possible to NOT completely and thoroughly describe this matter so that people that are otherwise able to program Android apps, can follow and succeed??

HOW?

Could anybody please tell me what else could be wrong?

Add-on: I set up everything exactly according to the specs, got my key from my debug.keystore, tried it with com.example for the maps demo, with my own package for my app. Does not work. Plus: that silly empty window. How on earth is that gonna work... :-(

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
742 views
Welcome To Ask or Share your Answers For Others

1 Answer

Assuming

  • you are trying this on a device that has access to Google Play Services
  • you have linked your project with the Google Play Services library
  • you have setup the necessary permissions like this:

snippet from manifest:

<!-- Specify the correct minSDK and targetSDK versions. -->
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<!-- Google Maps related permissions -->
<permission
    android:name="com.ecs.google.maps.v2.actionbarsherlock.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />

<!-- Network connectivity permissions -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

<!-- Access Google based webservices -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />
  • you have setup the map key like this :

enter image description here

  • you have put the meta-data tag inside the application tag

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyA_u1faIXRhx_Q7NafFbrhQJEerl6UUbPY" />
    
  • you made sure that you are building the APK with the correct keystore (corresponding to the one defined in the API console).

  • you removed and redeployed your application completely after checking / updating these steps you should be good to go.

From my experience I was able to follow the instructions on Google Maps Android API v2 Getting started, but I do recall having to completely undeploy and redeploy the app again after playing around with the API keys / permissions.

On what device are you running ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...