33444

google map authenticate failed, after package name changed

Question:

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.keystore

Answer5:

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.

Recommend

  • Can't access Facebook campaigns
  • How to upload files in php using html
  • Run script file on remote server
  • Granting permissions to Azure Active Directory Web Application automatically
  • php is_file always return false
  • How do I import an existing Grails 3 (3.0.12) project in IntelliJ 15
  • Retrieve IP address of device
  • Is it possible to open regedit and navigate to straight to a specific key using process.start?
  • cygwin cannot exec 'git-add--interactive' permission denied
  • Sequential (transactional) API calls in angular 4 with state management
  • Access Android Market through SSH tunnel
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • chrome.tabs.executeScript only fires when the Developer Console is open
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • How to set ini file attributes during an Inno install
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Why is an OPTIONS request sent to the server?
  • Spring Data JPA custom method causing PropertyReferenceException
  • C# - Serializing and deserializing static member
  • How to set/get protobuf's extension field in Go?
  • Sending data from AppleScript to FileMaker records
  • Cassandra Data Model
  • Trying to switch camera back to front but getting exception
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Importing jscolor library in angular 2
  • Upload files with Ajax and Jquery
  • R: gsub and capture
  • How to pass list parameters for each object using Spring MVC?
  • How to include full .NET prerequisite for Wix Burn installer
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Proper way to use connect-multiparty with express.js?
  • Benchmarking RAM performance - UWP and C#
  • Is it possible to post an object from jquery to bottle.py?
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • Net Present Value in Excel for Grouped Recurring CF