You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: How to connect devices to a dev box for development
3
+
description: This article provides step-by-step instructions on how to connect physical devices to a dev box for Android application development.
4
4
author: RoseHJM
5
5
ms.author: rosemalcolm
6
6
ms.service: dev-box
@@ -10,64 +10,119 @@ ms.date: 12/05/2024
10
10
#customer intent: As a developer, I want to set up dev box with physical Android devices so that I can efficiently develop Android applications.
11
11
12
12
---
13
-
13
+
14
14
# Connect physical devices to a dev box
15
-
16
-
This article provides a step-by-step guide on how to set up and use dev box with physical devices. By following these instructions, you can ensure a smooth connection and configuration for your development environment.
17
-
18
-
## Use dev box with physical Android devices to develop Android applications
19
-
20
-
**Prepare the machine you connect from:**
21
-
1. Open Device Manager, in the run window, run *devmgmt.msc*.
22
-
2. Check that your device shows like one of the following options:
23
-
a. Device name: Universal Serial Bus / Pixel 6
24
-
b. Android Device / Android Composite ADB Interface
25
-
3. Uninstall non-standard devices and drivers and restart.
26
-
4. Samsung devices will not connect if the ADB interface device exists on the machine you connect from. Uninstall the device.
27
-
28
-
**After your Andriod device and driver are verified:**
29
-
1. Open Local Group Policy Editor, run *gpedit.msc*.
30
-
2. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Connection Client\RemoteFX USB Redirection**.
31
-
3. Enable **RDP redirection of other supported RemoteFX USB devices from this computer** for **Administrators and Users**.
32
-
4. Apply the policy changes. From a cmd window `gpupdate /force`.
33
-
5. Restart your computer.
34
-
35
-
**From your dev box**
36
-
1. Open Local Group Policy Editor, run *gpedit.msc*.
37
-
2. Open **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection**.
38
-
3. Set **Do not allow supported Plug and Play device redirection**"** to **Disabled**.
39
-
4. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Connection Client\RemoteFX USB Device Direction**.
40
-
5. Enable "Allow RDP redirection of other supported RemoteFX USB devices from this computer", set to "Administrators and Users"
41
-
6. From a cmd window gpupdate /force
42
-
7. Restart your computer.
43
-
44
-
If the Android device is still not accessible to adb:
45
-
1. Open Device Manager, run *devmgmt.msc*.
46
-
2. Ensure the Google USB driver is installed and the device appears as "Android Device \ Android Composite ADB Interface" (https://developer.android.com/studio/run/win-usb). If your device is from another manufacture, check [this link](https://developer.android.com/studio/run/oem-usb#InstallingDriver) for manufacture specific drivers. The goal is to make the ADB interface device show up in Device Manager. Please note the device name can vary slightly from manufacture to manufacture, such as "Samsung Android Phone \ Samsung Android ADB Interface" or "Android Device \ Android Composite ADB Interface".
47
-
3. Restart your computer.
48
-
(consider make the above change in your DevBox image)
49
15
16
+
This article provides a step-by-step guide on how to set up and use dev box with physical devices to develop Android applications. By following these instructions, you can ensure a smooth connection and configuration for your development environment.
17
+
18
+
## Use dev box to develop Android applications
50
19
20
+
**Prepare the computer you connect from:**
21
+
1. To open Device Manager, from the search box on the taskbar, run `devmgmt.msc`.
22
+
1. Check that your device displays like one of the following options:
1. Uninstall nonstandard devices and drivers and restart your computer.
26
+
27
+
> [!CAUTION]
28
+
> Samsung devices will not connect if the ADB interface device exists on the computer you connect from. Uninstall the device.
29
+
30
+
**After your Android device and driver are verified:**
31
+
1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
32
+
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Connection Client\RemoteFX USB Redirection**.
33
+
1. Enable **RDP redirection of other supported RemoteFX USB devices from this computer** for **Administrators and Users**.
34
+
1. To apply the policy changes, from a cmd window, run `gpupdate /force`.
35
+
1. Restart your computer.
36
+
37
+
**From your dev box:**
38
+
1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
39
+
1. Open **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection**.
40
+
1. Set **Do not allow supported Plug and Play device redirection** to **Disabled**.
41
+
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Connection Client\RemoteFX USB Device Direction**.
42
+
1. Enable **Allow RDP redirection of other supported RemoteFX USB devices from this computer** for **Administrators and Users**.
43
+
1. To apply the policy changes, from a cmd window, run `gpupdate /force`.
44
+
1. Restart your computer.
45
+
46
+
**If the Android device is not accessible to ADB:**
47
+
1. To open Device Manager, from the search box on the taskbar, run `devmgmt.msc`.
48
+
1. Ensure the Google USB driver is installed and the device appears as **Android Device \ Android Composite ADB Interface** (https://developer.android.com/studio/run/win-usb).
49
+
- Devices from other manufacturers might not display in Device manager.
50
+
- If your device is from another manufacturer, check [Install a USB driver](https://developer.android.com/studio/run/oem-usb#InstallingDriver) for manufacturer specific drivers. The goal is to make the ADB interface device show up in Device Manager.
51
+
- The device name can vary from manufacturer to manufacturer, such as "Samsung Android Phone \ Samsung Android ADB Interface" or "Android Device \ Android Composite ADB Interface".
52
+
1. Restart your computer.
51
53
52
54
## Set up virtual switches for nested VMs
53
55
54
-
Dev box supports nested virtualization. You can create VMsinside a dev box and connect them to the default virtual switch "Default Switch". If for whatever reason you want to create another virtual switch with internet access, please follow these steps to set up a NAT network with an internal virtual switch.
56
+
Dev box supports nested virtualization. You can create virtual machines (VMs) inside a dev box and connect them to the default virtual switch *Default Switch*"*. If you want to create another virtual switch with internet access, set up a NAT network with an internal virtual switch. Use an IP address range that suits your required configuration.
55
57
56
-
> [!CAUTION]
57
-
> Incorrect configuration of virtual switch will cause you to lose the connection to Dev Box immediately and this is NOT reversable. Please setup with extreme care.
58
+
> [!WARNING]
59
+
> Incorrect configuration of virtual switch will cause you to lose the connection to dev box immediately and this is NOT reversable. Please setup with extreme care.
58
60
61
+
### Prerequisites
62
+
- On your dev box, install the Hyper-V and Virtual Machine Platform.
To find the *InterfaceIndex*, run `Get-NetAdapter`. Use the *ifIndex* of the adapter linked to the VM-Internal switch. If you choose a different IP range, ensure the IP address ends with “.1”.
1. Create guest VMs in your dev box, using the *VM-Internal* virtual switch. At this stage, the guest VM doesn't have internet access because it doesn't have an IP address.
66
86
67
-
## Connect USB devices to dev box
87
+
1. Assign IP addresses to the guest VM.
88
+
89
+
1. On the guest VM, set the IP address to an available address in the range, like 192.168.100.10, 192.168.100.11, etc.
90
+
1. Use the subnet mask 255.255.255.0, default gateway 192.168.100.1, and your desired DNS (for example, 8.8.8.8 for internet or your dev box's DNS).
91
+
1. Open Network Connections, right-click the network adapter, select **Properties** > **Internet Protocol Version 4 (TCP/IPv4)**.
92
+
93
+
:::image type="content" source="media/how-to-connect-devices-to-dev-box/tcpip-config.png" alt-text="Screenshot that shows the TCP/IP version 4 configuration dialog.":::
94
+
95
+
After setting the IP address, the setup is complete. Verify that you have:
68
96
97
+
- Internet access from the guest VM.
98
+
- Access between guest VMs.
99
+
- Access to guest VMs from the dev box.
69
100
101
+
## Prevent local drive redirection
70
102
103
+
By default, drives from your local client computer are available from within the dev box. This feature is called *drive-redirection*.
71
104
105
+
:::image type="content" source="media/how-to-connect-devices-to-dev-box/automatic-drive-redirection.png" alt-text="Screenshot that shows redirected drives on the dev box.":::
106
+
107
+
If you want to stop automatic local drive redirection, go to your dev box:
108
+
109
+
1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
110
+
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection**.
111
+
1. Set **Do not allow drive redirection** to **Enabled**.
112
+
113
+
Subsequent RDP sessions no longer have the local drive mapped.
114
+
115
+
## Connect USB devices to dev box
116
+
117
+
Connect the USB device like a YubiKey to your local computer. Start remote desktop to your dev box.
118
+
119
+
120
+
1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
121
+
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection**.
122
+
1. Set **Do not allow supported Plug and Play device redirection** to **Disabled**.
123
+
1. To apply the policy changes, from a cmd window, run `gpupdate /force`.
124
+
1. Restart your computer.
72
125
73
126
## Related content
127
+
128
+
- [Microsoft Dev Box: Frequently asked questions](dev-box-faq.yml)
0 commit comments