The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing


External Resources

More Info

Page tree
Skip to end of metadata
Go to start of metadata


Please notice this version of Virtual USB has been deprecated. We highly encourage updating to our latest version: Android Virtual USB Changelog

If you're still using version 1.0 - 1.2 we are not able to provide any support or guarantee the functionality of Virtual USB. If you have any question, please get in touch with us!

Versions 1.0-1.2 Only

These instructions are for versions 1.0-1.2 of Virtual USB for real devices. Use this link to get the most recent version: Click Here


  • This feature is available only on Private Android devices
  • Make sure you're using an ADB version above 1.0.39

Launch and Connect Virtual USB to a Real Device Live Testing Session

You can also find instructions for using the Virtual USB client by running java -jar client.jar --help.

  1. Download and install the Virtual USB for Live Testing client to the same machine where you have Android Studio installed.

    Client Download

    Use this link to download the Virtual USB Client.

  2. Get your User API key from the Account Settings menu in the Sauce Labs Real Device Cloud web interface. 

    Finding Your Real Device API Key

    This is not the same as your project API key, and is specific to your Sauce Labs account.

  3. From a command line, launch the client.

    java -jar client.jar server

    US Data Center

    If you are testing on a device in the US data center, you should also include the flags: --manualUrl --routerUrl wss://

    Verbose logging

    Optionally, use -v for verbose logging or -vv for super verbose logging

  4. Log in to and start a Live Testing session on one of the available Android devices.
    The project for the session should correspond to the API key you entered in Step 2, which is the account you logged in with.

  5. Open a new command line terminal, and query which sessions are running.

    java -jar client.jar sessions --apiKey <API KEY>

  6. This command will return a list of open sessions, find the <sessionId> and copy it.

  7. Use the live testing <sessionId> to connect the Virtual USB client to the real device in your session:

    java -jar client.jar connect --sessionId <session id> --apiKey <API KEY>
    java -jar client.jar connect --sessionId bwerg235-5214-4f14-889c-234va9v7a --apiKey 5a0d83ab-0ccb-42ff-a822-efb23d90b55d
  8. When Virtual USB connects to your live testing session, it will return a port number for the connection. Copy the port number  and use it to connect adb to your session device using Virtual USB.

    adb connect localhost:<paste returned port here>

    adb connect localhost:7000

At this point vUSB is fully connected and you can use Android Studio to debug your app, execute automation that is based on adb, or use any other tool that is adb compliant. For example, using adb shell, you can start the camera of the connected device:

adb shell
am start -a

Closing a Virtual USB connection

  1. Make sure you disconnect your device from ADB using adb disconnect <IPAddress>:<portNumber>

    adb disconnect localhost:7000
  2. Close your SauceLabs device view in your browser

Unsupported ADB commands

These ADB commands are not supported for use with Sauce Labs Virtual USB.

  • adb-reverse
  • No labels