Google-Cloud-TTS-Android
Google-Cloud-TTS-Android copied to clipboard
403 error load voice list
I got a 403 error, even when I am replacing the api_key
Your api_key application limit may be wrong. You need to choose Application restrictions [None]. Because Application restrictions [Android apps] google don't support gcp text to speech for android.
If you don't know how to change. The following are the steps.
go to here and select credentials. Select your api_key and edit. Find Application restrictions and select None and test it.
If you have some problem please let me know. Thank you.
Hi, Thank you for this nice project ;). Same error here whereas I have created a new API key with app restriction set to None. However, the API key is configured into a project with different package than yours. Is that a problem?
No. Do you have the error code ? Just like 401 or 403 etc...
To remove the error, you'll have to enable the Cloud TTS API in your GCP console. You can enable it here.
E/MainActivityPresenter: Loading Voice List Error, error code : 403 l have enable the Cloud TTS API in your GCP console and I have created a new API key with app restriction set to None. and still the same problem 403...
@aseelalawy Did you enable the Google cloud TTS api in your in your GCP console ?
Use the curl command and replace the below text YOUR_API_KEY to your google api key.
curl -H "X-Goog-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json; charset=utf-8" \
--data "{
'input':{
'text':'Hello I am david, Nice to meet you'
},
'voice':{
'languageCode':'en-gb',
'name':'en-GB-Standard-A',
'ssmlGender':'FEMALE'
},
'audioConfig':{
'audioEncoding':'MP3'
}
}" "https://texttospeech.googleapis.com/v1/text:synthesize"
If you don't enable the google cloud text to speech you will get the error message.
{
"error": {
"code": 403,
"message": "Cloud Text-to-Speech API has not been used in project project-id before or it is disabled. Ena
ble it by visiting https://console.developers.google.com/apis/api/texttospeech.googleapis.com/overview?project=project-id then retry.
If you enabled this API recently, wait a few minutes for the action to propagate to oursystems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console API activation",
"url": "https://console.developers.google.com/apis/api/texttospeech.googleapis.com/overview?project=
project-id"
}
]
},
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "SERVICE_DISABLED",
"domain": "googleapis.com",
"metadata": {
"service": "texttospeech.googleapis.com",
"consumer": "projects/project-id"
}
}
]
}
}
Otherwise, you will get the correct message.
{
"audioContent": "//NExAASqroAABhGudE...." // some base64 string
}
The same thing happened when I run this code in terminal for AutoML.
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" https://automl.googleapis.com/v1beta1/projects/121865889356/locations/us-central1/models/IOD5152058600083947520:predict -d @request.json