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 the instructions Android Debug Bridge (adb) Google docs.
- 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 at Google's site for Android developers.
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 connections to mobile farm devices via ADB.
The key will be available in all projects to which the user has been added.
To your profile
To another user's profile
- В control panels in the upper right corner, open the menu (account number) and select Profile and settings.
- Go to the section ADB keys.
- Click Add key.
- Enter the name of the key.
- Paste the public ADB key that you copied when creating an ADB key pair in step 3.
- Click Add.
Only users with roles Account Owner and User Administrator.
- В control panels go to Access control → User management.
- Open the tab with the desired user type.
- Open the user page → tab Access.
- In the block ADB keys click Add key.
- Enter the name of the key.
- Paste the public ADB key that you copied when creating an ADB key pair in step 3.
- Click Add.
4. Connect to the device via ADB
-
В control panels go to Mobile farm → Farms.
-
Open the mobile farm page.
-
Click on the serial number of the device.
-
Under the device name, copy the command to connect a mobile farm device of the form
adb connect <host>: <port>
, where:<host>
— DNS address for connecting to mobile devices;<port>
— connection port.
-
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 connecting 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