DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 964,423 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for With Broken USB Cable, How to Debug the App: Wireless Connect 😏
Divyam Ojas
Divyam Ojas

Posted on

With Broken USB Cable, How to Debug the App: Wireless Connect 😏

You are working nonstop to be promoted to Senior App Developer for months and this app project is the ladder to take you a step closer to it. But at the last moment, you broke your ladder. Goddd! Why me?? Sings in a corner "Give me some sunshine, give me some rain, give me another chance I wanna buy a USB cable once again"

Why not use Virtual Device? πŸ€”

Developing an app on a low-end laptop is truly annoying. There is already low RAM, and now you have to allocate some for the virtual device, thus making us stare at (Not Responding) added to the window title more than actually coding. We can’t just keep wasting our time like this, right? Especially when the project deadline is close and other clients keep nudging you to finish their projects. So we opt to connect our mobile phones with a USB cable and run the app on them. But this brings us to another problem!

What is the Problem With Using Cables? 🀯

Managing the cables and wires and wires and some more wires while working is a big headache. There is the charger cord, a wired keyboard, a wired mouse, your Wi-Fi dongle and maybe some other indispensable device, and then your mobile device to run the simulation. Product designers, following the "less is more" mantra, are ruthlessly reducing the number of ports on a laptop now. Dude, less is more for design, not functionality!!

Now there are fewer and fewer ports and more and more devices to connect to. Facing this crisis, we can do nothing but sacrifice for the greater good, especially when I am the chosen one and my laptop’s USB port/cable stops working (your name will be remembered in some GitHub repositories).

I wish I could connect my device without any cables! πŸ™πŸ»

Did I accidentally rub a genie lamp or what? There is actually a way to do wireless debugging!

I should have wished for my Hogwarts Invitation Letter instead!

While browsing through the developer options on my newly bought phone😌, I came across a new option… Wireless Debugging! Now I don't have to open the Amazon app to order a USB cable anymore. ✌️

Okay, so how do we Debug β€˜Wirelessly’? 😌

  • First of all, you have to turn on developer options. Go toΒ About Phone > VersionΒ and click on β€œBuild Number” 7 times. Woohooo! You're a developer now!

Turn On Developer options

  • Now Connect your deviceΒ to your laptop with a USB cable and selectΒ file transfer modeΒ ( while initializing for the first time, you still need a USB cable😞, but just for the first time and no more πŸ˜ƒ).

USB cable

  • Make sure both your devices are connected to theΒ same Wi-Fi networkΒ and ARE DISCOVERABLE.

    You canΒ ping your device to confirm it. Enter your mobile’s IP Address.

    Note: ToΒ find your device's IP address, you can simply click on Wireless Debugging or go toΒ About Phone > Status.

    ping 192.168.x.xxx
    

Ping mobile IP response

Yayyy!! We are connected now.

  • Now go to developer options andΒ turn on *USB Debugging*Β and allow debugging.
  • Turn on Wireless debugging, and a pop-up will appear asking you to confirm the network and device ID. Click "Allow.”

Turn on USB Debugging and Wireless Debugging

  • Now open your terminal and navigate to the folder containing adb.exe in Android SDK platform tools.
  • If you don't know theΒ adb.exeΒ file location, Open Android Studio, Tools > SDK Manager

Open SDK Manager

  • Copy theΒ Android SDK location

Copy Android SDK location

  • Navigate to the Android SDK platform tools in the terminal.
cd C:\Users\91825\AppData\Local\Android\Sdk\platform-tools
Enter fullscreen mode Exit fullscreen mode

Navigate to platform tools

  • First,Β kill the current serverΒ to avoid issues because of the running server.
.\adb kill-server
Enter fullscreen mode Exit fullscreen mode

ADB kill server

You will see another pop-up on your device to allow debugging. Click "Allow.”

  • Next, set the debugging port to 5555.
.\adb tcpip 5555
Enter fullscreen mode Exit fullscreen mode

adb tcpip 5555

Once again, click allow on the popup on your device.

  • The next and final step is toΒ connect
.\adb connect 192.168.x.xxx
Enter fullscreen mode Exit fullscreen mode

Connect the device

PS:Β When you click enter it will promptΒ failed to authenticate. Worry not my friend, once you allow the popup on your device, and repeat the same command, it will sayΒ already connected.

Now you can 'dis-entangle' your USB cable and put it back into your drawer. You are all set to work now.

Let’s catch up for a beer 🍻

Connecting devices wirelessly reduces the hassle of managing wires and also saves us a lot of time as we don’t have to use virtual devices. Now that we've got spare time on our hands, let’s use it for another project, or maybe connect on LinkedIn.

PS: I've tested this method for Windows + Android Mobile, will this work for Linux + Android too? Or Windows + iOS?

If you run an organization and want me to write for you, please do connect with me. πŸ˜ƒ

Top comments (12)

Collapse
 
aabhassao profile image
AabhasSao

Didn't knew this feature existed. Thanks a lot man πŸ’–. You've got some nice humour, it was fun to read.
Have to try this out with Mac + Android combo.

Collapse
 
aniket762 profile image
Aniket Pal

Yes! Even I will try the Mac n Android combo :)

Collapse
 
divyamojas profile image
Divyam Ojas Author

Please do πŸ™Œ

Collapse
 
divyamojas profile image
Divyam Ojas Author

Yeah sure, try it out and let me know too 😁

Collapse
 
pakdearsa profile image
PakdeArsa

thank... it's more simpler than AirDroid method

Collapse
 
divyamojas profile image
Divyam Ojas Author

Thanks for your appreciation 😁

Collapse
 
iamakl profile image
Ankush Lohani

Woohoo!! Informative❀️

Collapse
 
divyamojas profile image
Divyam Ojas Author

Thank you πŸ˜πŸ’–

Collapse
 
aniket762 profile image
Aniket Pal

Awesome Read! Never knew how to use have 2 devices in same network and run debugger. Doing it surely for my next app project πŸ’ͺ

Collapse
 
divyamojas profile image
Divyam Ojas Author

Thank you for reviewing the blog 🀭

Collapse
 
boyceyboycey profile image
BOYCEYBOYCEY

Dattebayo !

Collapse
 
divyamojas profile image
Divyam Ojas Author

Dattebayo!

πŸ‘‹ Hey, my name is Noah and I’m the one who set up this ad. My job is to get you to join DEV, so if you fancy doing me a favor, I’d love for you to create an account.

If you found DEV from searching around, here are a couple of our most popular articles on DEV: