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 (UNACCEPTABLE).
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("XXXXX-ZZZZZ").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')