Wi-Fi debugging in Android Studio is a convenient way to debug Android applications on physical devices without the need for a USB cable. It allows you to deploy, run, and debug your apps wirelessly, making the development process more flexible and mobile. Here’s how you can set up and use Wi-Fi debugging in Android Studio:
Prerequisites:
Android Device: You’ll need an Android device with developer options enabled. To enable developer options, go to “Settings” > “About Phone” > tap on “Build Number” multiple times (usually seven times) until you see a message confirming developer options are enabled.
Android Studio: Make sure you have the latest version of Android Studio installed on your computer.
Enabling Wi-Fi Debugging:
Connect to USB: Initially, you’ll need to connect your Android device to your computer via USB to set up Wi-Fi debugging.
Open Developer Options: On your Android device, go to “Settings” > “System” > “Developer options.” Scroll down to the “Debugging” section.
Enable Wireless Debugging: Find the option labeled “Wireless Debugging” or “Wireless ADB” and toggle it on.
Accept the Prompt: A prompt will appear asking you to accept the connection from your computer. Confirm it. Your device is now set up for wireless debugging.
Using Wi-Fi Debugging in Android Studio:
Disconnect USB: Once you’ve enabled wireless debugging, disconnect the USB cable from your device.
Connect to the Same Network: Ensure that your computer and Android device are connected to the same Wi-Fi network.
Launch Android Studio: Open Android Studio on your computer.
Connect via Wi-Fi: In Android Studio, go to “View” > “Tool Windows” > “Logcat” to open the Logcat panel. At the top of the Logcat panel, you’ll see a device dropdown. Click on it and select “Connect device over Wi-Fi.”
Select Your Device: A dialog will appear showing the list of available devices on your network. Select your Android device.
Connect: Click the “OK” button to establish the Wi-Fi connection between Android Studio and your device.
Debug Your App: You can now run and debug your Android app wirelessly, just like you would with a USB connection.
Please note that the Wi-Fi debugging connection may occasionally drop, especially if the device or computer changes networks or if there’s a network interruption. In such cases, you may need to reconnect via USB and repeat the setup steps.
Wi-Fi debugging in Android Studio provides more mobility and flexibility for debugging Android apps, making it easier to test and develop on physical devices without the constraints of a USB cable.