Connect to ADB

ADB is a communication protocol specific to Android that allows to connect or control an Android device from a computer.

ADB can be used with a Genymotion Device image instance to:

Prerequisite

Your EC2 firewall has an inbound rule to allow TCP port 5555 or SSH connection from authorized hosts. See .

Android SDK platform-tools are available from or Android Studio.

Android Studio includes the Android SDK platform-tools. By default, they are located in the following folders:

Step 1 - Toggle ADB connection

> Warning: ADB connections are neither secured nor authenticated. You should ONLY allow TCP port 5555 from authorized hosts in your Firewall inbound rules.

Instead of opening TCP port 5555, you can use an to secure the connection.

Web UI

1. Go to the Configuration panel. 2. In the ADB section, click on the toggle button to enable or disable ADB access.

Command Line (SSH)

> Warning: ADB connections are neither secured nor authenticated. You should ONLY allow TCP port 5555 from authorized hosts in your Firewall inbound rules.

Instead of opening TCP port 5555, use an to secure the connection.

HTTP API

You can use the POST method and call the /configuration/adb API to set the following variables:

For detailed usage, please refer to .

You can also use user data parameters to enable ABD connection at boot. For detailed instructions, please refer to .

Step 2 - Connect ADB to the instance

After enabling ADB connection, you can connect the instance to ADB.

Use an SSH tunnel

Though it is possible to open TCP port 5555 to restricted hosts in your EC2 firewall, using an SSH tunnel is the most secured method.

1. Set SSH access.

Follow the instructions from chapter to setup and enable SSH access to your instances.

2. Create an ssh tunnel.

In a new terminal/shell create an SSH tunnel:

ssh -i key.pem -NL 5555:localhost:5555 shell0@instance_ip()

> Warning: Do not close this terminal/shell or this will close the tunnel as well.

> Tip: To create a tunnel for other virtual devices, just increment the port number for every new virtual device (5556, 5557, 5558, etc.).

Example:

ssh -i key.pem -NL 5556:localhost:5555 shell0@instance2_ip()

With PuTTy

1. . 2. Go to Connection > SSH > Tunnels and set Source port to 5555 and Destination to localhost:5555. 3. Click on Add. 4. Click on Open to start the connection.

> Warning: The PuTTy terminal has to remain open during your operations. If PuTTY is closed, it will close the tunnel as well.

To create a tunnel for other virtual devices, increment the port number for every new virtual device (5556, 5557, 5558, etc.).

3. Connect ADB.

1. Open another shell to run other commands. 2. Connect your virtual device to ADB:

adb connect localhost:5555

To connect other virtual devices to ADB, increment the port number for every new virtual device (e.g. 5556, 5557, 5558, etc.).

Then, to connect this instance to ADB:

adb connect localhost:5556