|
1 | 1 | ---
|
2 |
| -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. |
| 2 | +title: How to connect Android devices to a dev box |
| 3 | +description: Learn how to connect Android devices to a dev box for efficient testing and debugging, enhancing your app development workflow and productivity. |
4 | 4 | author: RoseHJM
|
5 | 5 | ms.author: rosemalcolm
|
6 | 6 | ms.service: dev-box
|
7 | 7 | ms.topic: how-to
|
8 |
| -ms.date: 12/05/2024 |
| 8 | +ms.date: 12/11/2024 |
9 | 9 |
|
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. |
| 10 | +#customer intent: As a developer, I want to connect Android devices to my dev box so that I can develop apps for Android. |
11 | 11 |
|
12 | 12 | ---
|
13 | 13 |
|
14 |
| -# Connect physical devices to a dev box |
| 14 | +# Connect Android devices to a dev box |
15 | 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. |
| 16 | +Connecting Android devices to a dev box enhances your app development process by allowing you to test and debug directly on physical devices. This article provides step-by-step instructions to help you connect your Android devices to a dev box, streamlining your development workflow. |
17 | 17 |
|
18 |
| -## Connect Android devices to a dev box |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +- Access to a dev box |
| 21 | +- A client computer to connect to the dev box from |
| 22 | + |
| 23 | +## Prepare your client computer |
| 24 | + |
| 25 | +To connect Android devices to your dev box, you first connect the devices to client computer you use to connect to the dev box. |
| 26 | + |
| 27 | +### Connect Android devices |
| 28 | + |
| 29 | +Connect your Android device to the client computer you'll use to connect to your dev box. |
19 | 30 |
|
20 |
| -**Prepare the computer you connect from:** |
21 | 31 | 1. To open Device Manager, from the search box on the taskbar, run `devmgmt.msc`.
|
22 | 32 | 1. Check that your device displays like one of the following options:
|
23 | 33 | - Device name: Universal Serial Bus / Pixel 6
|
24 | 34 | - Android Device / Android Composite Android Debug Bridge (ADB) Interface
|
25 | 35 | 1. Uninstall nonstandard devices and drivers and restart your computer.
|
| 36 | +1. In Device manager, verify your Android device displays. |
26 | 37 |
|
27 | 38 | > [!CAUTION]
|
28 |
| -> Samsung devices will not connect if the ADB interface device exists on the computer you connect from. Uninstall the device. |
| 39 | +> Some devices like Samsung might not connect if the ADB interface device exists on the computer you connect from. To resolve this issue, uninstall the device. |
| 40 | +
|
| 41 | +### Configure USB redirection |
| 42 | + |
| 43 | +Configure following Local Group Policy settings to allow USB redirection on your client computer. |
29 | 44 |
|
30 |
| -**After your Android device and driver are verified:** |
31 | 45 | 1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
|
32 | 46 | 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**. |
| 47 | +1. Enable **Allow RDP redirection of other supported RemoteFX USB devices from this computer** for **Administrators and Users**. |
34 | 48 | 1. To apply the policy changes, from a cmd window, run `gpupdate /force`.
|
35 | 49 | 1. Restart your computer.
|
36 | 50 |
|
37 |
| -**From your dev box:** |
| 51 | +## Prepare your dev box |
| 52 | + |
| 53 | +When your Android devices are connected to your client computer, you can configure your dev box to access them by enabling USB redirection. |
| 54 | + |
| 55 | +### Configure USB redirection |
| 56 | + |
| 57 | +Configure following Local Group Policy settings to allow USB redirection on your dev box. |
| 58 | + |
38 | 59 | 1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
|
39 | 60 | 1. Open **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection**.
|
40 | 61 | 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**. |
| 62 | +1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Connection Client\RemoteFX USB Device Redirection**. |
42 | 63 | 1. Enable **Allow RDP redirection of other supported RemoteFX USB devices from this computer** for **Administrators and Users**.
|
43 | 64 | 1. To apply the policy changes, from a cmd window, run `gpupdate /force`.
|
44 | 65 | 1. Restart your computer.
|
45 | 66 |
|
46 |
| -**If the Android device is not accessible to ADB:** |
| 67 | +## Troubleshoot ADB Connection Issues |
| 68 | + |
| 69 | +If the Android device isn't accessible to ADB, check the latest device drivers are installed and the device displays in Device Manager. |
| 70 | + |
47 | 71 | 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). |
| 72 | +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 | 73 | - Devices from other manufacturers might not display in Device manager.
|
50 | 74 | - 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 | 75 | - 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 | 76 | 1. Restart your computer.
|
53 | 77 |
|
54 |
| -## Set up virtual switches for nested VMs |
55 |
| - |
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. |
57 |
| - |
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. |
60 |
| -
|
61 |
| -### Prerequisites |
62 |
| -- On your dev box, install the Hyper-V and Virtual Machine Platform. |
63 |
| - |
64 |
| -### Create virtual switch with NAT network |
65 |
| - |
66 |
| -1. Create internal virtual switch: |
67 |
| - ```powershell |
68 |
| - New-VMSwitch -SwitchName "VM-Internal" -SwitchType Internal |
69 |
| - ``` |
70 |
| -
|
71 |
| -1. Create an IP address for the NAT gateway |
72 |
| - ```powershell |
73 |
| - New-NetIPAddress -IPAddress 192.168.100.1 -PrefixLength 24 -InterfaceIndex 34 |
74 |
| - ``` |
75 |
| -
|
76 |
| - 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”. |
77 |
| -
|
78 |
| -1. Create the NAT network |
79 |
| - ```powershell |
80 |
| - New-NetNat -Name VM-Internal-Nat -InternalIPInterfaceAddressPrefix 192.168.100.0/24 |
81 |
| - ``` |
82 |
| -
|
83 |
| -### Configure guest VMs |
84 |
| -
|
85 |
| -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. |
86 |
| -
|
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: |
96 |
| -
|
97 |
| -- Internet access from the guest VM. |
98 |
| -- Access between guest VMs. |
99 |
| -- Access to guest VMs from the dev box. |
100 |
| -
|
101 |
| -## Prevent local drive redirection |
102 |
| -
|
103 |
| -By default, drives from your local client computer are available from within the dev box. This feature is called *drive-redirection*. |
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. |
125 |
| -
|
126 | 78 | ## Related content
|
127 | 79 |
|
128 | 80 | - [Microsoft Dev Box: Frequently asked questions](dev-box-faq.yml)
|
0 commit comments