Connect to the device via ADB
Android Debug Bridge (ADB) is a tool that allows you to interact with Android OC devices through a command line interface. For example, you can:
- run shell commands and applications;
- remotely debug applications;
- transfer files between your mobile device and your computer;
- to get the logs;
- reboot the device;
- change the settings of the device.
Learn more about the Android Debug Bridge tool in Google's Android Debug Bridge (adb) documentation instructions.
- Install Android SDK Platform Tools.
- Create an ADB key pair.
- Add a public ADB key.
- Connect to the device via ADB.
1. Install Android SDK Platform Tools
Download the Android SDK Platform Tools distribution for your operating system from Google's Android developer site.
2. Create an ADB key pair
Linux
macOS
Windows
-
Open the CLI.
-
Create a pair of ADB keys and place them in the folder where they will be stored:
cd ~/.android/
adb keygen adbkey
adb pubkey ~/.android/adbkey > ~/.android/adbkey.pub -
Copy the public ADB key:
xclip -sel clip < ~/.android/adbkey.pub
-
Open the CLI.
-
Create a pair of ADB keys and place them in the folder where they will be stored:
cd ~/.android/
adb keygen adbkey
adb pubkey ~/.android/adbkey > ~/.android/adbkey.pub -
Copy the public ADB key:
pbcopy < ~/.android/adbkey.pub
-
Open the CLI.
-
Create a pair of ADB keys and place them in the folder where they will be stored:
cd %USERPROFILE%\.android\
adb keygen adbkey
adb pubkey %USERPROFILE%\.android\adbkey > %USERPROFILE%\.android\adbkey.pub -
Copy the public ADB key:
type %USERPROFILE%\.android\adbkey.pub | clip
3. Add a public ADB key
You can add a public ADB key to your profile or to another user's profile, and then use it to connect to Mobile Farm devices over ADB.
The key will be available in all projects to which the user has been added.
To your profile
To another user's profile
- In the control panel, on the top menu, click Account.
- Go to Accessibility → ADB Keys tab.
- Click Add Key.
- Enter the name of the key.
- Paste the public ADB key that you copied when you created the ADB key pair in step 3.
- Click Add.
Only users with the Account Owner and User Administrator roles can add keys to other users.
-
In the control panel, on the top menu, click Account.
-
Go to the section with the desired user type:
- Users — for the users of the control panel;
- Service users — For service users.
-
Open the user page → Access tab.
-
In the ADB Keys block, click Add Key.
-
Enter the name of the key.
-
Paste the public ADB key that you copied when you created the ADB key pair in step 3.
-
Click Add.
4. Connect to the device via ADB
-
In the dashboard, from the top menu, click Products and select Mobile Farm.
-
Go to the Farms section.
-
Open the mobile farm page.
-
Click on the serial number of the device.
-
Under the device name, copy the command to connect the mobile farm device of the form
adb connect <host>: <port>
, where:<host>
— DNS address for connecting to mobile devices;<port>
— port to connect to.
-
Open the CLI.
-
Connect to the device — run the command you copied in step 4.
Even with a successful connection, an authentication error will appear in the response:
failed to authenticate to adb.mobfarm.selectel.ru:3094
Here:
adb.mobfarm.selectel.ru
— DNS address for connection to mobile devices;3094
— example of a port to connect to.
-
To verify that the connection is established, request a list of connected devices:
adb devices -l
A list of connected devices will appear in the response. For example:
List of devices attached
adb.mobfarm.selectel.ru:3094 device product:AD8-RU model:TECNO_AD8 device:TECNO-AD8 transport_id:1