android adb调试_如何安装和使用ADB(Android调试桥实用程序)

本文详细介绍了如何设置Android SDK,启用手机USB调试,安装ADB及其驱动程序,以及将ADB添加到系统PATH。ADB是Android SDK中的一个命令行工具,用于通过USB在计算机上控制设备,备份和恢复手机,安装应用等。文章提供了测试ADB连接,安装设备驱动,以及使用ADB的有用命令的步骤。
摘要由CSDN通过智能技术生成
android adb调试

android adb调试

android-plush

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.

ADB,Android Debug Bridge,是Google的Android SDK附带的命令行实用程序。 ADB可以通过USB通过计算机控制您的设备,来回复制文件,安装和卸载应用程序,运行Shell命令等等。

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.

我们还介绍了过去需要ADB进行的其他一些技巧,包括备份和还原智能手机或平板电脑,以及默认情况下将Android应用安装到SD卡 。 ADB用于各种怪异的Android技巧。

第一步:设置Android SDK (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.

转到Android SDK下载页面,然后向下滚动到“仅SDK工具”,这是一组包含ADB的工具。 下载适合您平台的ZIP文件,然后将其解压缩到要存储ADB文件的任何位置(它们是可移植的,因此可以将它们放置在所需的任何位置)。

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.

启动SDK Manager EXE并取消选择除“ Android SDK Platform-tools”以外的所有内容。 如果您使用的是Nexus手机,则可能还需要选择“ Google USB驱动程序”来下载Google的驱动程序。 单击安装按钮。 这将下载并安装平台工具包,其中包含ADB和其他实用程序。

image

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

完成后,您可以关闭SDK管理器。

第二步:在手机上启用USB调试 (Step Two: Enable USB Debugging on Your Phone)

usb_debugging

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”.

回到“设置”主页面,您应该在底部附近看到一个名为“开发人员选项”的新选项。 打开它,然后启用“ USB调试”。

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.

稍后,当您将手机连接到计算机时,将看到一个名为“允许USB调试吗?”的弹出窗口。 在您的手机上。 选中“始终允许这台计算机允许”框,然后点击确定。

第三步:测试ADB并安装手机的驱动程序(如果需要) (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”.

打开安装了SDK工具的文件夹,然后打开platform-tools文件夹。 这是ADB程序的存储位置。 按住Shift并在文件夹内单击鼠标右键。 选择“在此处打开命令窗口”。

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是否正常运行,请使用USB电缆将Android设备连接到计算机,然后运行以下命令:

adb devices
image

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.

您的手机制造商可能会为您的设备提供可下载的驱动程序包。 因此,请访问他们的网站并找到适合您设备的驱动程序-摩托罗拉的驱动器在这里 ,三星的驱动器在这里 ,而HTC则是称为HTC Sync Manager的套件的一部分。 您也可以在XDA Developers中搜索无需额外软件的驱动程序下载。

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.

如第一步所述,您还可以尝试从SDK Manager窗口的Extras文件夹中安装Google USB驱动程序。 此功能适用于某些手机(包括Nexus设备)。

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.

如果您使用Google的USB驱动程序,则可能不得不强制Windows为您的设备使用已安装的驱动程序。 打开设备管理器(单击“开始”,键入“设备管理器”,然后按Enter),找到您的设备,右键单击它并选择“属性”。 如果设备驱动程序未正确安装,则可能会在设备旁边看到黄色的感叹号。

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.

您会在安装Android SDK文件的“其他”文件夹中找到Google USB驱动程序。 选择google\usb_driver文件夹,然后单击下一步。

image

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

安装设备的驱动程序后,插入手机,然后再次尝试使用adb devices命令:

adb devices

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

如果一切顺利,您应该会在列表中看到您的设备,并且可以开始使用ADB了!

第四步(可选):将ADB添加到系统PATH (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.

就目前而言,您必须导航到ADB的文件夹并在需要时在其中打开命令提示符。 但是,如果将其添加到Windows System PATH,则没有必要-只需在命令提示符下键入adb即可在任何需要的位置运行命令,无论您位于哪个文件夹中。

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

在Windows 7和10上,此过程略有不同,因此请查看我们的完整指南,以编辑系统路径 ,以了解执行此操作所需的步骤。

有用的ADB命令 (Useful ADB Commands)

In addition to the variety of tricks that require ADB, ADB offers some useful commands:

除了需要ADB的各种技巧外,ADB还提供了一些有用的命令:

adb install C:\package.apk – Installs the package located at C:\package.apk on your computer on your device.

adb install C:\ package.apk –在设备上的计算机上安装位于C:\ package.apk的软件包。

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 uninstall package.name –从设备中卸载具有package.name的软件包。 例如,您将使用名称com.rovio.angrybirds来卸载Angry Birds应用程序。

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

亚行推送   C:\ file / sdcard / file –将文件从计算机推送到设备。 例如,此处的命令将计算机上位于C:\ file的文件推送到设备上的/ sdcard / file

adb pull /sdcard/file C:\file – Pulls a file from your device to your computer – works like adb push, but in reverse.

adb pull / sdcard / file C:\ file –将文件从设备拉至计算机–类似于adb push,但相反。

adb logcat – View your Android device’s log. Can be useful for debugging apps.

adb logcat –查看Android设备的日志。 对于调试应用程序可能很有用。

adb shell – Gives you an interactive Linux command-line shell on your device.

adb shell –在设备上为您提供交互式Linux命令行shell。

adb shell command – Runs the specified shell command on your device.

adb shell 命令 –在设备上运行指定的shell命令。



For a full guide to ADB, consult the Android Debug Bridge page on Google’s Android Developers site.

有关ADB的完整指南,请查阅Google的Android开发者网站上的Android调试桥页面

Image Credit: LAI Ryanne on Flickr

图片信用: Flickr上的LAI Ryanne

翻译自: https://www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/

android adb调试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值