How to Connect Android Studio With Testdroid Cloud Devices

Bitbar, the mobile devops company. Logo, large

Dear Testdroiders,

As it seems that Google is officially ending the support of Eclipse-based Android Development Toolkit (ADT), we’ve prepared everything for you in Android Studio and our Gradle-based plugin is readily available to get your tests seamlessly running from Android Studio (instead of using our old Eclipse-plugin) to Testdroid Cloud.

According to that blog, Google will end their development and official support for ADT at the end of this year and both Eclipse ADT and Android Ant build system are affected.


First of all, you might want to consider installing Testdroid plugin for Android Studio. We’ve described all required steps in this blog so please take a look at it and follow those instructions to get Testdroid Gradle-plugin installed on your Android Studio environment. After this, you can instantly – just by one click – launch tests on Testdroid Cloud devices.

Migrate Your Projects from Eclipse to Android Studio

If you haven’t updated your projects to Android Studio yet and still are using Eclipse-based environment follow the few steps and you’ll get everything smoothly converted and aligned with Android Studio projects. In Android Studio, select File -> New -> Import Project as shown in picture below:

Screen Shot 2015-06-30 at 1.51.04 PM

Select your project and enter a path where new Gradle-based project will be created, and click Next. You’ll be prompted with the following questions:

Screen Shot 2015-06-30 at 1.59.28 PM

Click Finish – and new project will be automatically generated for you. Now, if you confront any issues or generating the project doesn’t work for some reason automatically, please check this tutorial for all details about migration.

Connect Android Studio and Testdroid Cloud

Now, you are ready to install – or if you have done it already – use your Testdroid Gradle-plugin and push all generated APKs instantly to real devices for runs. In a nutshell, there are basically two options to get your app (and instrumentation APK) running on Testdroid Cloud. First, you can go to a project specific path and execute the following command:

./gradlew testdroidUpload

Alternatively, you can use the instant way and click testdroidUpload that can be found under Gradle -> (app) -> Verification.

Screen Shot 2015-05-26 at 10.36.13 AM

If your project isn’t compiled, clicking this link will get it done, plus fetches all required dependencies (if missing) and uploads the package(s) to Testdroid Cloud. The Run log looks like this:

Screen Shot 2015-05-26 at 10.41.31 AM

Android Developer – Check How Your App Is Doing

In case you are new to Testdroid Cloud, take a look at this guide to walk you through some basic things and steps how to use it. With Testdroid Cloud, you get all details of your test run, such as logs, screenshots, performance stats and much more – and all this are conveniently shown in our easy-to-use UI.

Screen Shot 2015-05-26 at 11.39.47 AM

In example above, we ran empty Android Studio app project on 8 devices. The Test Execution time is minuscule as there isn’t much logic in empty app. Also, the App Crawler run targeted for this sort of app basically checks whether app can be appropriately launched and stopped – and use those as test cases.

Want to see how all this worked? Here is the same as a video:

Advanced Configuration Parameters

To get all out of this awesome “development tool – real device” combination you might want to consider further modifying and configuring your test runs. We’ve done this easy as part of the configuration illustrated above, and the following additional parameters, can be used to further configure your project settings:

testdroid {
    username  ""                       // Username
    password "password"                                 // Password
    deviceGroup "MyTestDevices"                         // Device group for execution

    cloudUrl = ''            // Optional - Used for PrivateCloud configs
    projectName "Project 1"                             // Optional - Default: create a new project
    mode "FULL_RUN"                                     // FULL_RUN / APP_CRAWLER / UI_AUTOMATOR
    testRunName "Custom test run name"                  // Optional - default: build variant name

    deviceLanguageCode "en-US"                // Optional - locale <ISO 63>_<ISO 3166> default: en-US

    hookUrl "http://localhost:9080"           // Optional - call back URL after test run has finished

    scheduler "PARALLEL"                      // Optional - PARALLEL or SERIAL default: PARALLEL

    testScreenshotDir = "/sdcard/abc"         // Optional - custom screenshot folder 

    // AppCrawler configuration - set application credentials
        applicationPassword = "appPassword2"
        applicationUserName = "appUsername2"

    // Optional - Custom settings for test execution
    fullRunConfig {
        instrumentationRunner =  ""
        withAnnotation = ""
        withOutAnnotation = ""
        limitationType = "CLASS"
        limitationValue = ""
        instrumentationAPKPath = "/tmp/mytestapp.apk" // Optional - custom instrumentation apk path

    // Optional
    uiAutomatorTestConfig {
        uiAutomatorTestClasses = "foo.class"
        uiAutomatorJarPath = "tmp/uitests.jar"

Enjoy This Awesome and Handy Plugin – Happy Testing!

5 Things to Consider When Adopting Mobile App Test Automation

Learn these aspects to improve test efficiency and effectiveness.