The Java/Android client used to work flawlessly, but This error occurred a few weeks ago and still no fix. My app users are getting very frustrated.
You can also find this issue here: http://stackoverflow.com/questions/43289297/google-translate-api-sometimes-takes-very-long-time-to-initialize/43316549?noredirect=1#comment73880159_43316549
Translate translate = TranslateOptions.newBuilder().setApiKey(MY_API_KEY).build().getService(); Sometimes Takes Very Long time
In my Main Activity, I initialize the Translate variable. If you look at the logs: I track when the initialization starts and when it finishes. Most of the time it initializes quick. But 1/5 times it takes up to 30 seconds to 3 minutes.
Example Code
AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {
@Override
public void onPostExecute (Void aVoid) {
Log.i("APP", "finished");
}
@Override
protected Void doInBackground(Void... voids) {
Log.i("APP", "start");
Translate translate = TranslateOptions.newBuilder().setApiKey("AIzaSyB7cCDBbeoZ2tYTH-Ynv25OaPraLmTG7Hw").build().getService();
return null;
}
};
asyncTask.execute();
I also have the latest versions in gradle:
compile ('com.google.cloud:google-cloud-translate:0.11.0-alpha')
compile ('com.google.apis:google-api-services-translate:v2-rev49-1.22.0')
0.13.0-apha isn't available but i tested with beta and still same issue.