'Google cloud Text to speech API error 403 Flutter-Android

I try to integrate the Google cloud text to speech API. It works fine if I don’t restrict the key. But when I restrict it doesn’t work.

I am building this application using Flutter.

I keep getting the following error:

{
  "error": {
    "code": 403,
    "message": "Requests from this Android client application <empty> are blocked.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "API_KEY_ANDROID_APP_BLOCKED",
        "domain": "googleapis.com",
        "metadata": {
          "service": "texttospeech.googleapis.com",
          "consumer": "projects/864328698167"
        }
      }
    ]
  }
}

Any help would be appreciated. Thanks, everyone



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source