Ben-J
Ben-J

Reputation: 1125

Play Services not available on Cloud Test Lab

I try to run my tests in Google Cloud Test Lab. My unit tests and espressos test passe with no problems.

But for some espresso tests that require Google Apis, like maps and places, my tests fails.

In more when I run this exact code in Google Cloud Test Lab it fails and return "No play services availables !" :

@org.junit.Test
public void testPlayServicesAvailables() throws Exception {
    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int result = googleAPI.isGooglePlayServicesAvailable(WayzUpApp.getContext());
    if (result != ConnectionResult.SUCCESS) {

           throw new Exception("No play services availables !");

    }
}

To launch my cloud tests I use the command :

gcloud beta test android run --app app/build/outputs/apk/app-debug.apk --test app/build/outputs/apk/app-debug-androidTest.apk --device-ids Nexus5 --os-version-ids 23 --locales fr --orientations portrait

Is there a way to make Play services availables on Cloud Test Lab?

Thanks.

Upvotes: 0

Views: 271

Answers (1)

abielita
abielita

Reputation: 13469

From this thread, if you need the Google Play Services for your app, and there is "No play services available", there is no way to get your app working.

You can check if the services are enabled from within your app with GooglePlayServicesUtil.isGooglePlayServicesAvailable(android.content.Context) which returns ConnectionResult.SUCCESS if Play Services is available.

You can also check this blog and this tutorial on how to test with Google Cloud Test Lab.

Upvotes: 0

Related Questions