Google Maps Android API v2: Authorization Denied

I am trying to show my Google Maps in my application but it doesn't work and this error appears:

01-25 11:38:54.763: E/Google Maps Android API(30514): Authorization failure.

      

I am currently using the SHA1 certificate thumbprint from the issue certificate that was used to publish my app to the AppStore.

Edit . I have also enabled Google Map API v2 in the API Console.

I read from the comments here that "The signature algorithm MUST be SHA1withRSA and NOT SHA256withRSA". However, I created an issue certificate from Eclipse and it is SHA256withRSA and I haven't made any configuration. I can't change it either.

Can someone enlighten me if the signature algorithm is causing the problem? If so, how do I change the signature algorithm in eclipse?

+3


source to share


3 answers


Figured out my problem.

I was generating keys from my issue certificate which DOESN'T WORK while debugging when running the app on my phone. Instead, I have to use the debug keystore certificate thumbprint.



Don't forget to save 2 keys:

  • Disable the API key from the debug repository when running it on your phone.

  • The release certificate API key to use when you want to sign the app just before deploying it to the Google Play Store.

+4


source


Check if your API key exists or not with the matching SHA, if it doesn't regenerate it with the matching SHA. If you don't know how to generate it, please try it below:

JAVA_HOME\bin > keytool -list -v -alias androiddebugkey -keystore "~\.android\debug.keystore" -storepass password(your_own) -keypass "password(your_own)"

      

Check your manifest file if you wrote two meta tags like



<!--<meta-data-->
<!--android:name="com.google.android.maps.v2.API_KEY"-->
<!--android:value="AIzaSyBHghWPWutTiOxCJKll2WoCuVOQ5YotLiY" />-->

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

      

Comment on any of these, for my project used geo.API_Key

it will handle both GEO and Google Maps.

More importantly, import the google-services.json file into the application folder.

+1


source


Check what you have enabled Google Maps Android API v2

in google api console.

enter image description here

0


source







All Articles