راهنمای استفاده از گزینه Debug در اندروید
ADB, Android Debug Bridge, is a command-line utility included with Google’s Android SDK. ADB can control your device over USB from a computer, copy files back and forth, install and uninstall apps, run shell commands, and more.
We’ve covered some other tricks that require ADB in the past, including backing up and restoring your smartphone or tablet and installing Android apps to your SD card by default. ADB is used for a variety of geeky Android tricks.
Image Credit: LAI Ryanne on Flickr
Install Java JDK & Android SDK
Before installing the Android SDK, you’ll have to install Oracle’s Java development kit. You candownload it from here – ensure you download the x86 (32-bit) version, even if your computer uses a 64-bit operating system.
Even if you already have the Java runtime (JRE) installed, you’ll need to install the JDK as well.
With the Java JDK installed, you can now download the Android SDK from Google and install it on your computer. If you see a Java-related error during installation, ensure you downloaded and installed the x86 version of the JDK, not the x64 one.
Android SDK Setup
Once the Android SDK is downloaded and installed, launch the SDK Manager application from your Start menu.
Enable the Android SDK Platform-tools checkbox and click the Install button. This downloads and installs the platform-tools package, which contains ADB and other utilities.
Enable USB Debugging
To use ADB with your Android device, you must enable USB debugging on it. You’ll find this option under Developer Options on your device’s Settings screen.
Test ADB and Install Device Drivers
Locate the android-sdk’s folder. Note the SDK path displayed at the top of the SDK Manager window.
If you used the default install location, you’ll find ADB in the following directory:
If you used a different install location, you’ll find ADB in the platform-tools directory inside your android-sdk directory.
Browse to this directory, hold Shift and right-click inside it, and select Open command window here.
To test whether ADB is working properly, connect your Android device to your computer using a USB cable and run the following command:
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 manufacturer may provide a downloadable driver package for your device. You can also try installing the Google USB Driver from the Extras folder in the SDK Manager window.
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.
On the Driver tab, click Update Driver.
Use the Browse my computer for driver software option.
Navigate to the following folder if you installd the Google USB driver:
(Check the extras\google\usb_driver folder under the android-sdk folder if you installed the Android SDK to a non-default location.)
Once you’ve got your drivers correctly installed and the adb devices command indicates it can communicate with your Android smartphone or tablet, you can start using ADB.
In addition to the variety of tricks that require ADB, ADB offers some useful commands:
adb install C:\package.apk – Installs the package located at C:\package.apk on your computer on your device.
adb uninstall package.name – Uninstalls the package with package.name from your device. For example, you’d use the name com.rovio.angrybirds to uninstall the Angry Birds app.
adb push C:\file /sdcard/file – Pushes a file from your computer to your device. For example, the command here pushes the file located at C:\file on your computer to /sdcard/file on your device
adb pull /sdcard/file C:\file – Pulls a file from your device to your computer – works like adb push, but in reverse.
adb logcat – View your Android device’s log. Can be useful for debugging apps.
adb shell – Gives you an interactive Linux command-line shell on your device.
adb shell command – Runs the specified shell command on your device.
For a full guide to ADB, consult the Android Debug Bridge page on Google’s Android Developers site.
- ۲۱۹ نمایش