service_android

ADB (لمطوري اندرويد) USB كيفية عمل تنفيذ او تست لتطبيق اندرويد عن طريق الوايفاي بدون استخدام

I discovered this little trick a year ago and it was immensely helpful. So far, whenever I was working on my Android apps, I had to connect it to my laptop with a USB cable. The USB cable is annoying and limits my movements. Consequently, I was researching, if there is an option to do the debugging over WiFi.

Luckily, there is a super simple way! All you need is a USB cable (for the initial setup) and have both devices in the same network.

Step One: Set Up the Android SDK

Head to the Android SDK download page and scroll down to “SDK Tools Only”, which is a set of tools that includes ADB. Download the ZIP file for your platform and unzip it wherever you want to store the ADB files–they’re portable, so you can put them anywhere you want.

Start the SDK Manager EXE and deselect everything except “Android SDK Platform-tools”. If you are using a Nexus phone, you may also want to select “Google USB Driver” to download Google’s drivers. Click the Install button. This downloads and installs the platform-tools package, which contains ADB and other utilities.

image

When it’s finished, you can close the SDK manager.

 

Step Two: Enable USB Debugging on Your Phone

usb_debuggingTo use ADB with your Android device, you must enable a feature called USB debugging. Open your phone’s app drawer, tap the Settings icon, and select “About Phone”. Scroll all the way down and tap the “Build Number” item seven times. You should get a message saying you are now a developer.

Head back to the main Settings page, and you should see a new option near the bottom called “Developer Options”. Open that, and enable “USB Debugging”.

Later on, when you connect your phone to your computer, you’ll see a popup entitled “Allow USB Debugging?” on your phone. Check the “Always allow from this computer” box and tap OK.

Step Three: Test ADB and Install Your Phone’s Drivers (if Needed)

Open the folder that you installed the SDK tools in and open the platform-tools folder. This is where the ADB program is stored. Hold Shift and right-click inside the folder. Choose “Open Command Window Here”.

image

To test whether ADB is working properly, connect your Android device to your computer using a USB cable and run the following command:

adb devices

1
You should see a device in the list. If your device is connected but nothing appears in the list, you’ll need to install the appropriate drivers.

Your phone’s manufacturer may provide a downloadable driver package for your device. So head to their website and find the drivers for your device–Motorola’s are here, Samsung’s are here, and HTC’s come as part of a suite called HTC Sync Manager. You can also search XDA Developers for driver downloads without the extra software.

You can also try installing the Google USB Driver from the Extras folder in the SDK Manager window, as we mentioned in the first step. This will work with some phones including Nexus devices.

image

If you use Google’s USB driver, you may have to force Windows to use the installed drivers for your device. Open the Device Manager (click Start, type Device Manager, and press Enter), locate your device, right-click it and select Properties. You may see a yellow exclamation mark next to the device if its driver isn’t installed properly.

image

On the Driver tab, click Update Driver.

image

Use the Browse my computer for driver software option.

image

You’ll find the Google USB Driver in the “Extras” folder where you installed your Android SDK files. Select the google\usb_driver folder and click Next.

image

Once you’ve installed your device’s drivers, plug in your phone and try the adb devices command again:

adb devices

If all went well, you should see your device in the list, and you are ready to start using ADB!

 

Step Four (Optional): Add ADB to Your System PATH

As it stands, you have to navigate to ADB’s folder and open a Command Prompt there whenever you want to use it. However, if you add it to your Windows System PATH, that won’t be necessary–you can just type adb from the Command Prompt to run commands whenever you want, no matter what folder you’re in.

The process is a bit different on Windows 7 and 10, so check out a full guide to editing your System PATH for the steps required to do this.

Steps Five : to Revolutionize your Android Coding Experience

  1. You need to connect your device to your computer via USB cable. Make sure USB debugging is working. You can check if it shows up when running adb devices.1
  2. Run adb tcpip 5555
  3. Disconnect your device (remove the USB cable).
  4. Go to the Settings -> About phone -> Status to view the IP address of your phone.
  5. Run adb connect <IP address of your device>:5555
  6. If you run adb devices again, you should see your device.

Now you can execute adb commands or use your favorite IDE for android development – wireless!

Do I Have to Repeat the Process Every Time?

Now you might ask, what do I have to do when I move into a different work space and change WiFi networks? You do not have to repeat steps 1 to 3 (these set your phone into WiFi-debug mode). You do have to connect to your phone again by executing steps 4 to 6.

Unfortunately, the android phones lose the WiFi-debug mode when restarting. Thus, if your battery died, you have to start over. Otherwise, if you keep an eye on your battery and do not restart your phone, you can live without a cable for weeks!

Happy wireless coding!

Facebook Comments