Recently I got one of those new 12 inch MacBooks that only comes with one USB-C port(yeah I know, I’m a fuckwit). I ended up getting the $100+ official Apple adapter so I could output HDMI and use normal USB stuff but I forgot to get a USB hub and right now the one USB port I have is filled by the wireless mouse I’ve been using. So yeah, I decided maybe it’d be a good time to check out wireless debugging. Keep reading for more details.
This explanation assumes a few things. First and foremost that you have a mac. The second is that your device is connected to your mac via USB and has USB Debugging switched to on. Make sure your device is also connected to the same WIFI network as your mac.
Okay so the first thing you’re going to want to do is download the ADT Bundle, you can get it here. Once you have it downloaded, move the folder named platform-tools somewhere easy to work with. Personally I moved it into my documents folder. Now open up a terminal window, and hit in the following command:
sudo vi .bash_profile
You’ll be asked for your password and then met with the vi interface to edit your bash_profile file after you punch it in. Hit the I key, this will put you into insert mode. Add the following line to the file (if you did the same as me and put the platform tools in your documents folder) and hit the esc key, followed by :wq and then hit enter. This writes the changed and brings you out of vim editing.
This needs to be added to so you can use the adb commands in terminal. You’ll need to fill in the <username> part with your username. My username on my mac is jordanholland, so in my case I added this:
If this worked when you enter:
You should be met with a version number, if you weren’t successful it will just say that the command adb doesn’t exist. Okay, so now you’ve got adb working(hopefully) enter this next command:
adb tcpip 5555
This just sets the port for connecting to your device to 5555. Now go to your device, and find out what your IP is for it on your current network. This can usually be found in the wifi settings of the device when you tap on the network you’re connected to. Once you have the IP hit in the command:
adb connect <device ip>
In my case the command was:
adb connect 10.12.3.3
And this will be met with the following response if you were successful:
connected to 10.12.3.3:5555
Once you’re connected you should be able to go into Android Studio and run your project from your device wireless. Cool huh? Also keep in mind that you can turn this server off at anytime using this command: