How To Connect An Android Device With A USB Cable or WiFi or A Bonus Method

Connect Your Device To Computer For Debugging your App

How To Connect An Android Device With A USB Cable or WiFi or A Bonus Method

INTRODUCTION

While Developing for Android I Have Encountered with one Problem That is to test our app we need to Connect To a Real Android Device And For That We Have Two Options And That is Android Emulator Or A Real Android Device.

Why Don't I Use A Android Emulator

Android Emulator Requires A Heavy Amount Of Hardware Requirements which becomes a hindrance in the life of android development So, If You Have a PC with A Great Amount Of Hardware like an SSD, A Processor With A Clock Speed Of More Than A 3.0gHz and Other. That's Why I Avoid To Keep My PC Free From Covering This Much Resources

How To Use A Real Android Device

To Use A Real Android Device We Can Use 3 Methods :-

Connect Via USB Cable

To Connect Via USB Cable You Have To Follow Some Small Method That is:-

  1. Go To Settings
  2. Visit To The About Device
  3. Open Software Information
  4. Click On Build Number For About 8-9 Times
  5. A Small Box shows

    Now You're A Developer

  6. Search For Developer Options
  7. Enter In it.
  8. Connect The Phone With A USB Cable
  9. Enable USB Debugging. Check Out This For The Above Method

Connect Via Wireless Debugging

  1. Have You Downloaded Android Studio If Not Download Download Android Studio
  2. Connect The Laptop And The Phone With same WiFi.
  3. Open Android Studio And Land On This Screen. AS - main.png
  4. Click On The Wireless Debugging which is Found in the Developer Options. SmartSelect_20220702-163306_Settings[1].jpg
  5. Now Connect Both Devices With A Same WiFi Network📶 .
  6. Now Open The Developer Options On Your Device On Which You Would Test Your App.
  7. Switch On The Wireless Debugging And Click On The Wireless Debugging Option. Screenshot_20220702-160618_Settings[1].jpg
  8. Now, You Have Two Options By Pair Device with QR Code And Pair Device with Pairing Code.
  9. If You Want To Scan The QR Code, Then Click On The Pair Device With QR Code On Android And On The Screen You Will Be Shown With The QR Code. Then Scan The QR Code. AS wireless wifi.png
  10. If You Want To Pair Device With Pairing Code. Click On The Option Then You Will Be Displayed With A Code And On Computer Click On The Pairing Code. Screenshot 2022-07-02 163139.png
  11. Click On The Pair Option And Now Your Phone is Paired With Computer For Wireless Debugging.

Now A Bonus Method And The Easiest Method

  1. Open The Path In An terminal/powershell
    cd C:\Users\[USER_NAME]\AppData\Local\Android\Sdk\platform-tools
    
  2. Connect Your Device With USB

  3. type the below in the terminal/powershell

    adb tcpip 5555
    
  4. Find Your Device's IP Address From Your Device Settings

  5. After This Then Type this in the terminal/powershell

    adb connect [IP_ADDRESS]:5555
    *remove brackets
    
  6. And It Will Result

image.png

  1. Which Shows Your Device is Successfully Running On The Wireless Debugging

This Method Is Working For All Types If You Are using On Wifi or Mobile HotSpot For Future Better Using Of The Feature Add The Path To The Environment Variables

Hope You Liked The Blog And If You Face Any Issue Direct Message Me On My Twitter Handle or Comment .