Home » How to Build Your Own Android Device Cloud

How to Build Your Own Android Device Cloud - Adventures in QA

How to Build Your Own Android Device Cloud

In this post I will describe how to build your own Android device cloud in the office. You may think this is expensive and will take lots of time and work, but I promise it isn’t. After installing the device cloud you are able to control the real Android devices from your web browser no matter how far you are away from the real device. For all iOS testers and developers out there, I must say sorry, this post is only handling Android devices until know the tool I will use is not supporting iOS. Before I get started with the installation and setup I list shortly the hardware and software I used to setup the whole system.

Hardware and Software

Lets start with the software that is managing the Android devices. The software is called openstf, where STF stands for Smartphone Test Farm. The software is open source and is maintained by Simo Kinnunen and Günther Brunner. STF offers a plethora of really cool features like

  • Keyboard & Mouse Input
  • Copy & Paste to and from the device
  • Take Screenshots
  • Drag & Drop APK files
  • Open URLs in any installed browser
  • Display Logs
  • Run Shell Commands
  • Debug Remotely with Android Studio
  • and many more

OpenSTF is the only software you need to install for the device management. However, you also need to install the Android SDK, Java SDK as well as XCode. The installation of the software will be explained a bit later in this post.

Lets get to the hardware. I used the following hardware to build the device cloud. To install the needed software a Mac mini is a good choice. It is slim, powerful and fits perfect into the server rack. In my case I used a mac mini with Intel Core i5@2.6GHz, 8GB RAM and 256GB SSD disk.

The next piece of hardware that you need is a server rack to lock the devices and the mac mini. The good thing about a real server rack over any other locker is the ventilation system that helps to cool down the mac mini as well as the devices. We bought the following 19 inch server rack with 15 height units from ebay for ~200€

19inch Server Rack 15U - How to Build Your Own Android Device Cloud

To connect many devices to the openSTF system we used 2 USB hubs with an additional power support to charge the devices and to be able to send commands to them (60€ each). One power cord extension and some velcro fastener to stick the USB hubs under the shelfs inside the server rack. The guys from openSTF listed some more recommended hardware to setup the device cloud. The complete list can be found here.

Another piece of hardware we added to our device cloud are device holders. With the help of the holder we are able to add even more devices next to each other on a single shelf. Since we have a 3D printer in the office we printed the device holders for our self :). We used the following 3D model to print them.


Day 1 - 20 days of testing at XING- Adventures in QA
Device Holder - Android Device Cloud - Adventures in QA
- Android Device Cloud - Adventures in QA

If you have a 3D printer as well, you can find some more models here and here.

Devices - Android Device Cloud - Adventures in QA

How to Build Your Own Android Device Cloud

Now that the hardware is in place you can start with the installation of the required software. First make sure that the mac mini has the latest Java SDK installed. If the SDK is not installed, download it from here and follow the provided instructions. The next piece of software that you need to download and install is Android Studio and the required API levels. Download the latest version of Android Studio from http://developer.android.com/sdk/index.html  and follow the installation instructions provided on the Android Studio page. When Android Studio is installed open the SDK Manager to install the required API levels for your app.

When Java and Android Studio are installed, make sure that both are set in the PATH variable of the command line. The following code snippet shows an excerpt of the bash_profile file.

# Android Home
export ANDROID_HOME="/Users/YOUR_USER/Library/Android/sdk"

# Java Home
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home"

# User configuration
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="${PATH}:/Users/YOUR_USER/Library/Android/sdk/platform-tools"
export PATH="${PATH}:/Users/YOUR_USER/Library/Android/sdk/tools"

export PATH="${PATH}:$JAVA_HOME"

Now you are ready to install openSTF. Find the latest installation instruction for openSTF on the GitHub page of the project. The installation of openSTF is straight forward and very easy to perform. Make sure you have admin rights on the mac mini in order to install required software for openSTF.

Start the Device Farm

After the installation of openSTF you are almost done with the setup phase of the Android device cloud. In order to start openSTF you need to open 2 terminal windows and execute in the first one


and in the second window execute

stf local

After a couple of seconds the openSTF system is up and running. You can access it via a browser by typing http://localhost:7100.

If you want to make the Android device cloud available to other colleagues start openSTF with the following parameter:

stf local --public-ip <IP_ADDRESS>

Now the system is also available via the given IP address. If you face any kind of problem with the setup of openSTF check the FAQ section.

Add Devices

Until now the openSTF interface shows no devices. The next step is now to add real Android devices to the USB hubs, to make them visible for openSTF and other colleagues. In order to add devices to the system, make sure the developer options and USB debugging are activated on each device. To activate the developer options open settings app -> About the phone and tap 7 times on the build number. Then go back to the settings overview and find the developer options. Open the developer options with a tap and activate USB debugging. Now connect the device to the USB hubs. When device is connected you will see the dialog to grant access to the device via adb. If the access has been granted, openstf will automatically install the STF services on the phone. After a couple of seconds the device will show up in the device list of the test farm and is ready to use.

STF - Android Device Cloud - Adventures in QA

Connect a Device to Android Studio

Once the devices are added to the device cloud, you can connect them to your IDE e.g. Android Studio. To connect a device, select one from the list in STF. On the dashboard tab there is a section called “Remote debug”. In this section the adb connect command is shown with the ip address and port of the device. Copy the command to your shell and execute it.Remote Debug - Android Device Cloud - Adventures in QA

Now the device is connected to your computer and can be used within the IDE or via the command line. Execute the command

adb devices

to see if the device is connected and available. Now that the device is connected, you can start a build e.g. in Android Studio and select the real Android device from the device chooser dialog.

Device Chooser - Android Device Cloud - Adventures in QA

Once the build is finished, the apk file will be installed on the Android device in your own device cloud.

Device Farm in Action

To get an idea how openSTF is working, I created the following YouTube video which shows the Android device cloud in action after the initial setup and without the rack :).

That’s it, now you have a running Android device cloud in your office ready to be used for manual testing, automated checking and debugging. If you plan to build the same Android device cloud, I would be more than happy to see some pictures of your solution.


Server Rack Image Source: http://ecx.images-amazon.com/images/I/51RhnebQdKL.AC_UL320_SR284,320.jpg


  1. David says:

    Thanks for the article, good read. Would be interesting to see if anyone has alternate device lab setup requirements. For us, we could use an internal device lab, but one where the mobile devices are distributed across a site location (not all housed under a server rack cabinet, etc.), e.g. a device in the lobby, one in the break room, one in rest room, etc. all interacting with some other non-mobile devices over wifi and bluetooth – location aware applications, etc. That kind of deployment presents itself unique constraints and solutions. We haven’t gotten to the point of actually deploying a prototype. More of just brainstorming at the moment due to funding constraints.

    Also hope that we can have a iOS equivalent solution to what you presented. That’s a critical platform/market to cover.

    • Daniel says:

      Hi David,

      I would love to see other solutions if there are any, especially for iOS :). I have a question to you, why do you want to have this kind of setup you mentioned? Why devices in the rest room and so on :)? What is the idea behind this?
      Looking forward to hear from you.

      Best and HappyTesting

  2. Jerimiah says:

    Is your stf instance stable on the mac mini? I’ve got 4 devices in my setup and they all periodically disconnect from the host with adb. If you have found a workaround, I’d love to hear about it. Otherwise I’m going to have to build a Linux box….

    • Daniel says:

      Hi Jerimiah,

      yes the openstf is stable for us. We have more than 10 devices connected and everything is in a stable state. We just updated to the latest version of it. The mac mini is still running on El Capitan, have you updated to Sierra already? ADB has problems with Sierra and you need to stop and start adb like every 5 minutes. Maybe that is the issue on your side?

      Have a great day!

      • Jerimiah says:

        I was indeed on Sierra. I started over with El Capitan, and it’s better, but stf still starts go haywire around the 3 or 4 hour mark. Looking at the console, it starts losing devices and tries over and over to reconnect. After I stop stf and run ‘adb devices’, nothing is shown. I have to kill and restart adb, then restart stf, and then it happens again in a few hours. I’ve got 11 devices connected, using the recommended Plugable brand powered hubs.

        I wonder if it has to do with which version of adb is installed. I’m using the latest installed by Android Studio, and it’s 1.0.36. Which version are you using?

        • Daniel says:

          Hi Jerimiah,

          I have the latest openstf running on a Mac mini with El Capitan. The adb version is the same like yours 1.0.36 rev. 0a04cdc4a62f-android. Do you have the possibility to test it on El Capitan mac? Many of my colleagues who updated to Sierra, face the same adb connection loss issue.


  3. Subash says:

    Is stf bound by the 15 devices limit imposed by adb (per machine) ? because adb scans only 30 ports range

    The ADB server only checks for devices by scanning odd-numbered ports in the range 5555 to 5585 ( 30 ports in total) and assigns 2 ports for each device. Is ADB capable of accepting more than 15 Android Devices (15×2 ports) or can I connect more devices on the same computer? I think it is impossible to run more than one ADB servers on the same machine.

  4. vishal says:

    I have one Android device connected with my local set up no STF at this moment. My problem is that device(connected with USB cable) keeps loosing charge after a period of time ( 1-2 days ) and eventually dies down. Will STF take care of this problem ? I have tester in remote location who want to access this device farm from my location , will that work?

    • Daniel says:

      Hi Vishal,

      sometimes this happens. Check the stf page for supported hardware. The guys added a list of supported powered USB hubs that may prevent this issue.


    • Daniel says:

      Hi Nizamuddin,

      what do you mean by this? You can control real Android devices from any browser from any device. However, you can’t attach iOS devices to the farm, only Android is supported but you can control an Android phone with an iPhone :).


  5. Dirk says:

    Hi Daniel,

    thanks for your interesting report. We use stf too and have the problem that the device battery is swelling up. How do you manage this? I read you have a ventilation system. Is it enough to solve the problem?

    thanks in advance

    • Daniel says:

      Hi Dirk,

      thanks for your comment. Well, we have a server rack which is providing a better ventilation by default. The temperature in the rack is OK, devices are around 30 degree celsius. We only had one device with a broken battery but that was it. What I do from time to time is rebooting the devices and exchange them with other devices, maybe this helps.

      What kind of USB hubs are you using? And what kind of locker?


  6. Dirk says:

    Thanks for your fast reply. We use:

    TRIPP LITE 16-Port USB Sync Charging
    TRIPP LITE 3U Rack Mount Storage Shelf
    Server Rack 42 height units

    In the server rack are servers too. I think thats the reason for the battery problem, cause there is no ventilation system.
    I try to get the 15u server rack as recommended by you.

    • Daniel says:

      You are welcome. Yes maybe the other servers are causing the high temperature and battery issues. Check on stf page what the device temperature is. Just checked on our devices, in the info tab of each device. Most of the devices are between 24 – 30C.


Leave a Reply