I run windows in KVM, and the QEMU android Emulator that ships with Android studio crashes all the time, so the obvious solution, with all those android devices I have is to connect a phone to android studio, It is faster and spares me the hassle of finding out why nested virtualization is so terrible
But having a phone connected via USB is not optimal, as i have to pick it up every time i want to run my under development software on it !
The answer seems to be in the
1- install Android WiFi ADB : A plugin easy to install in Android studio
2- A phone with Android 11 and above
So let us do this step by step
- Download SDK platform-tools and install it (Copy it somewhere and add that to your system path)
- Enable developer options on the phone (Keep tapping build number)
- From developer options, Enable wireless debugging
- Select Pair device with pairing code. Take note of the pairing code, IP address, and port number displayed on the device (see the above image).
- Open the command prompt and run the command adb pair ipaddr:port
adb pair 192.168.7.101:45353
Enter pairing code: xxxxxx
daemon not running; starting now at tcp:5037
daemon started successfully
Successfully paired to 192.168.7.101:45353 [guid=adb-RF8M4xxxxxxx-xxxxxxx] - Now, to have it appear as a device in android studio… Go to wireless debugging and notice the port number, then using that IP and port, use the following command
adb connect 192.168.7.101:35127 - Recommended: Install the “Android WiFI ADB” plugin in android studio
Note: The Pairing port is not the same as the connection port ! so pay attention to that