我需要在客户的电脑上安装ADB,以便连接到Android手机并在其中安装apk。考虑到SDK的大小,有没有可能在不安装整个SDK的情况下完成这个操作?
可以的
- 首先,您需要一个可以从互联网部分下载zip文件内容的程序。
- 设置好后,转到SDK下载页面并获取SDK链接。
- 在zip文件中,导航到“android-sdk-windows\tools”
- 从那里仅选择“adb.exe”,“AdbWinApi.dll”和“AdbWinUsbApi.dll”
- 下载。
来源:http://twigstechtips.blogspot.in/2011/07/android-downloading-adb-without-sdk.html
现在它已经作为一个独立的工具正式由谷歌发布了。您可以从这里下载:SDK平台工具版本发布
我从http://adbshell.com/downloads下载了 adb.exe
和所需的.dll
文件。
非常简约,但正好满足所需。
平台工具已移至不同的软件包,因此上述列出的方法不再适用。
2020年4月4日可行的方法:
adb devices
,您的设备现在应该在设备列表中可见。设置ADB的路径变量。 新的Android Studio ADB位置为
C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools
将此路径添加到Path环境变量中。
右键单击我的电脑 -> 单击属性 ->高级系统设置 ->环境变量 ->系统变量。 ->滚动查找Path变量和路径
C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools;(不要从此文本框中删除现有路径字符串)。点击确定。
现在,从计算机的任何位置运行命令提示符并运行adb devices
命令即可正常工作!
有关更多详细信息,请访问官方xda开发者论坛:https://www.xda-developers.com/install-adb-windows-macos-linux/
只需从任何现有的Android SDK/平台工具文件夹中复制以下文件到您的电脑上,它就可以正常工作:
AdbWinUsbApi.dll AdbWinApi.dll adb.exe
如果你使用的是Ubuntu系统,你可以使用apt命令
sudo apt install adb
请注意最后一部分:
这个软件包建议安装"android-sdk-platform-tools-common",其中包含了Android设备的udev规则。如果没有安装这个软件包,adb和fastboot需要以root权限运行。
这意味着下载sdk可能是值得的。但是在apt上托管的sdk的占用空间似乎比android网站上找到的zip文件要小得多。
$ apt show adb
Package: adb
Version: 1:8.1.0+r23-5~18.04
Priority: optional
Section: universe/devel
Source: android-platform-system-core
Origin: Ubuntu
Maintainer: Android Tools Maintainers <android-tools-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 253 kB
Provides: android-tools-adb
Depends: android-libadb (= 1:8.1.0+r23-5~18.04), android-libbase, libc6 (>= 2.24), libgcc1 (>= 1:3.0), libstdc++6 (>= 6)
Recommends: android-sdk-platform-tools-common
Breaks: android-tools-adb (<< 6.0~)
Replaces: android-tools-adb (<< 6.0~)
Homepage: https://android.googlesource.com/platform/system/core
Download-Size: 97.4 kB
APT-Manual-Installed: no
APT-Sources: http://jp.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
Description: Android Debug Bridge
A versatile command line tool that lets you communicate with an emulator
instance or connected Android-powered device.
.
This package recommends "android-sdk-platform-tools-common" which contains
the udev rules for Android devices. Without this package, adb and fastboot need
to be running with root permission.
$ apt show android-sdk-platform-tools-common
Package: android-sdk-platform-tools-common
Version: 27.0.0+10~18.04.2
Priority: optional
Section: universe/devel
Source: android-sdk-meta (25.0.0+10~18.04.2)
Origin: Ubuntu
Maintainer: Android Tools Maintainers <android-tools-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 50.2 kB
Download-Size: 12.2 kB
APT-Manual-Installed: no
APT-Sources: http://jp.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
Description: Tools for interacting with an Android platform - Common files
The Android SDK includes a variety of tools that help you develop mobile
applications for the Android platform. The tools are classified into 3 groups:
SDK Tools, Platform-tools and Build-tools.
.
Platform-tools are customized to support the features of the latest Android
platform.
.
This package provides common files of Android SDK Platform-tools. It also
provides UDEV rules enabling adb and fastboot to work without root access to
the host machine.