I have an android app with a Google map, everything works good.
In order to publish it in Google play, I changed the package name (old package com.exmaple..) from project----- Android tools---Rename Application Package
So, I going to generate a new API key with my new package name.
I changed manifest with the new key.
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="xxxxxxxxxxxxnew keyxxxxxxxxxxxxx" />
But, it did not work. It said authentication failed. Is there any idea? Did I miss some steps?
Thanks in advance!Answer1:
If you are saying that you have generated the new key using the
API Console and changed the API key in your application as well as changed the package name in those two permissions:
<permission android:name="your.application.package.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="your.application.package.permission.MAPS_RECEIVE"/>
Then try to remove your application complete from the phone, as application is usually saves the old key in the cache, and then try to re-install it.Answer2:
As you have renamed your package name and Google API key is generated based on the Package name and SHA1 key to uniquely identify each application. You need to regenerate your API key and then try to apply it in your manifest file.Answer3:
Please check out the documentation<blockquote>
To access the Google Maps servers with the Maps API, you have to add a Maps API key to your application. The key is free, you can use it with any of your applications that call the Maps API, and it supports an unlimited number of users. You obtain a Maps API key from the Google APIs Console by providing your application's signing certificate and its package name. Add the key to your application by adding an element to your application's AndroidManifest.xml file.</blockquote>
You changed your package name so google map authentication is failed. Please regenerate new key with your new package name.Answer4:
Addition to the answer before.
Make sure signing API key by the release keystore instead of debug.keystoreAnswer5:
If you checked and found that the package name is configured correctly in Google API, go over the below steps<ol><li>Make sure that there is no reference in your project to the old package name. I changed it in the manifest file but forgot to change it in the build.gradle file</li> <li>Delete the .gradle folder in your project cause gradle might have cashed the old package name</li> <li>Ctrl+Shift+F to look for the old package name in the entire project.Make sure there is no trace of it </li> <li>Uninstall the app on your testing device to clear any cached data </li> <li>Clean project and then run it</li> </ol>
Those steps did it for me.