# Connect to ADB
ADB is a communication protocol specific to Android that allows to connect or control an Android device from a computer.
It can be used with a Genymotion PaaS instance for:
- controlling an instance Android OS
- connecting an instance to a developer's tool (IDE), such as Android Studio, VS Code, JetBrains Rider, etc.
- accessing an instance shell
- uploading files to an instance
Google's Android SDK platform-tools from https://developer.android.com/studio/#command-tools (opens new window) or Android Studio.
The Android SDK platform-tools are included with Android Studio. By default, they are located in the following folders:
# Enable ADB
When enabling ADB, your instance becomes accessible using the standard 5555 TCP port. Since the ADB connection is neither secured nor authenticated, we strongly recommend to only open TCP port 5555 to specific hosts in your Security Group and/or EC2 Firewall.
Alternatively, we recommend using an SSH tunnel to secure the connection.
# Create an SSH tunnel
It is assumed that you have already read the Accessing a virtual device from SSH chapter.
# With SSH client
key.pem is your private key and instance_IP is the IP of your virtual device instance.
shell is a specific user for SSH operations. Do not use a different username.
From a new terminal/shell create an SSH tunnel:
ssh -i key.pem -NL 5555:localhost:5555 [email protected]_ip
Do not close this terminal/shell or this will close the tunnel as well.
To create a tunnel for other virtual devices, make sure you increment the port number for every new virtual device (5556, 5557, 5558, etc.) For example:
ssh -i key.pem -NL 5556:localhost:5555 [email protected]_ip2
# With PuTTy
OpenSSH is now included with Windows 10 by default (see this article (opens new window)). PuTTy is no longer necessary nor recommended with Windows 10.
- Go to Connection > SSH > Tunnels and set
Source portto 5555 and
- Click on
- Then, click on
Opento start the connection.
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, make sure you increment the port number for every new virtual device (5556, 5557, 5558, etc.)
# Connect ADB to the instance
- Open another shell to run other commands.
- Connect your virtual device using
adb connect localhost:5555. This command is optional as the first virtual device might have been automatically connected to ADB.
To connect other virtual devices to ADB, make sure you increment the port number for every new virtual device (e.g. 5556, 5557, 5558, etc.). For example:
ssh -i key.pem -NL 5556:localhost:5555 shell\@instance\_ip2\
Then, to connect this instance to ADB:
adb connect localhost:5556