How to connect a virtual device to ADB in Genymotion SaaS?

The tutorial explains how to connect a running virtual device to ADB in Genymotion SaaS. The target audience is users of Genymotion SaaS.

Requirements

Step 1 – Create an API token

An API token authenticates the gmsaas CLI.

Log in to your Genymotion SaaS portal.

Navigate to the API section.

Click Create.

Provide a description such as "gmsaas token" and click CREATE.

A new token is generated and displayed.

Click COPY to copy the token to your clipboard.

The token cannot be viewed again after creation.

Save the token somewhere safe before closing the popup.

Your new token is displayed in the Your API Tokens section.

Step 2 – Install and configure gmsaas CLI

Step 2 installs and configures the gmsaas CLI.

Python 3.8+ and pip3 20.9+ must be installed on the workstation.

A virtual Python environment is highly recommended.

Run the command to install the CLI: pip3 install gmsaas.

Gmsaas is installed with all its dependencies.

For more details about installation, refer to the gmsaas online user manual.

Authenticate gmsaas with the API token generated in Step 1.

Run: gmsaas auth token <token>.

Configure gmsaas to set the Android SDK path.

Run: gmsaas config set android-sdk-path <sdk_path>.

Replace <sdk_path> with the path to the Android SDK installation directory.

Note that gmsaas does not support relative paths.

Verify the setup with the doctor command.

Run: gmsaas doctor.

Step 3 – Connect the device to ADB

Launch the device and copy its UUID.

Obtain the UUID from the Genymotion SaaS dashboard or from the gmsaas instances list command.

Run: gmsaas instances adbconnect <instance_uuid>.

Replace <instance_uuid> with the UUID of the running device.

Example command: gmsaas instances adbconnect d1a6ffae-fd8d-4a37-bac4-0f185757f22c.

Your device should then be connected to adb.

Verify with the adb devices command.

The example output shows localhost:44615 device.

Now you can pass adb commands to your virtual device.