The supplied API key is not configured for use fro

2019-07-25 19:20发布

问题:

Below are the steps I have done:

  1. Select Google Maps Road API and restrict the key to android by passing SHA key and Package name.

  2. I have also enable the another API i.e Google Maps Android API which is working fine with the code.

  3. I have removed the restriction of key but getting same result.

  4. On Developer console, every google map road API request goes into the error column.

Please, help me solve this issue as I'm not able to figure out what's wrong with this another API key's are working fine but getting error in road API.

{
  "error": {
    "code": 403,
    "message": "The supplied API key is not configured for use from this Android app.",
    "status": "PERMISSION_DENIED",
    "details": [
    {
      "@type": "type.googleapis.com/google.rpc.Help",
      "links": [
      {
        "description": "Google developer console API key",
        "url": "https://console.developers.google.com/project/41764599888/apiui/credential"
      }
      ]
    }
    ]
  }
}

回答1:

After spending hours on google map road api ,

i came to the solution:

This is tip which is over google map road api:

During development and testing, you can register a project for testing purposes in the Google API Console and use a generic, unrestricted API key. When you are ready to move your app or website into production, register a separate project for production, create a server-restricted API key, and add the key to your application.

You just need to remove restriction from the key as i was doing this before in wrong way.