Android是最可定制的操作系统之一,因为您可以调整Android 设备(Android device)上的几乎所有内容。与 iOS 不同,Android甚至允许您从非官方来源下载应用程序并将其安装到您的设备上。
这意味着您不再需要依赖官方的Google Play 商店(Google Play Store)来获取您的应用程序,因为您可以从任何来源获取任何应用程序并将其安装在您的设备上而不受任何限制。
在Android 设备(Android device)上安装应用程序的一种方法是使用ADB(Android 调试桥)(ADB (Android Debug Bridge))实用程序。它是一种工具,可让您从计算机在设备上执行各种命令。这些命令之一可让您直接从计算机上的终端或命令提示符窗口在(Terminal or Command Prompt window)Android 设备(Android device)上安装应用程序。
以下指南是关于如何使用ADB在不离开机器的情况下安装新应用程序和从设备中删除现有应用程序的全部内容。我将使用Mac来执行以下指南中的步骤。对于Windows 和 Linux 用户(Windows and Linux users),这些步骤会略有不同。
(Download & Install ADB)在您的计算机上(Your Computer)下载并安装 ADB
ADB是一个非常棒的实用程序,因为只要您的设备连接到计算机,它就可以让您在设备上执行许多任务。您可以安装和卸载应用程序,将设备重新启动到恢复模式(recovery mode),并从您的机器上在您的设备上执行一些其他任务。
要使用ADB在您的设备上安装应用程序,您需要做的第一件事是在您的计算机上下载并设置ADB 工具。(ADB tool)它适用于所有三种主要操作系统,包括Windows、
Mac和Linux。
前往Android 官方网站上的 ADB 页面(ADB page on the official Android website)并下载适用于您操作系统(operating system)的软件包。下载后,将文件从存档中提取到您的计算机。
如上所示,您将在提取的文件夹中获得一些文件。您无需打开任何这些文件,因为您将使用终端(Terminal)来处理这些文件。
为ADB 通信(ADB Communication)准备设备(Device)
现在ADB 工具(ADB tool)已下载并在您的计算机上进行了所有设置,您需要准备Android 设备(Android device)以进行ADB 通信(ADB communication)。默认情况下,您的设备不会在您的机器上被识别,因为您需要先在设备上启用一个选项。
- 在您的 Android 设备上,启动设置(Settings)应用程序并点击关于手机(About phone)。
- 您将在以下屏幕上看到有关您手机的信息。(see information)查找(Find)并点击内部版本号(Build number)选项大约 7-8 次,它会说您是开发人员。
- 返回设置(Settings)应用程序,您会发现一个新选项,即开发人员选项(Developer options)。进入这个新选项并打开显示(option and turn)USB 调试(USB debugging)的选项。这是允许您的设备通过ADB与您的计算机通信的选项,并且在您使用(ADB)ADB时必须启用它。
使用 ADB 安装应用程序
您的设备和计算机现在都已准备好使用ADB,所以让我们开始使用该工具在您的设备上安装应用程序。
- 使用USB 电缆将您的(USB cable)Android 设备(Android device)插入计算机。如果您的设备提示您选择连接模式(connection mode),请选择数据传输。
- 如果您是Windows 用户(Windows user),请打开包含ADB文件的文件夹,按住键盘上的Shift键,右键单击屏幕上的任意位置,然后选择在此处打开命令窗口(Open a command window here)。
- 如果您是 Mac 用户,请启动终端(Terminal)应用程序,输入cd,按空格键,将(Spacebar)ADB 文件夹(ADB folder)拖放到终端窗口(Terminal window)上,最后按 Enter(Enter)。您的 ADB 文件夹现在应该是Terminal中的当前工作目录。
- 在终端窗口中键入./adb devices并按Enter。它将列出连接到您的机器的所有ADB兼容设备。您会在此设备列表中找到您的手机。
- 现在ADB识别您的设备,输入./adb install,按空格键,将您的(Spacebar)Android 应用(Android app) APK 文件(APK file)拖放到终端窗口(Terminal window),然后按Enter。它将在您的设备上安装选定的应用程序。
打开设备上的应用程序抽屉(app drawer)以确认是否确实安装了该应用程序。
使用此方法,您可以在 Android 设备上安装任意数量的应用程序,而无需离开计算机。
使用 ADB 卸载应用程序
ADB
还允许您从计算机上卸载安装在设备上的应用程序,但有一个问题。您必须知道要从您的设备上卸载的应用程序的包名称,这是你们许多人可能不知道的。(package name)
每个
Android 应用程序(Android app)都有一个包名称(package name),但遗憾的是您无法在设备上轻松找到它们。不过,为了帮助您完成任务,有一个应用程序可让您显示设备上所有应用程序的包名称(package name)。
前往Google Play 商店并(Google Play Store and download)在您的设备上下载并安装App Inspector 。启动它,使用ADB(ADB)选择要卸载的应用程序,您将在屏幕上看到应用程序包名称。(package name)
返回计算机上的终端(Terminal)。键入./adb uninstall,按空格键(Spacebar),输入应用程序包名称(app package name),然后按 Enter 键(Enter)。
您
选择的应用程序(chosen app)将在您的Android 设备(Android device)上卸载。
如果您的计算机上有很多Android 应用程序(Android apps),您可以使用ADB 工具(ADB tool)在您的设备上一一安装这些应用程序,而无需将它们传输到您的设备。
How To Install Apps On Your Android Device From Your Computer
Android is one of the most customizablе operating systems out there as you can tweak pretty much everything on your Android device. Unlike iOS, Android even allows you to download and install apps onto your device from unofficial sources.
What that means is you no longer need to rely on the official Google Play Store to get your apps as you can get any app from any source and install it on your device without any restrictions.
One of the ways to install apps on an Android device is to use the ADB (Android Debug Bridge) utility. It is a tool that allows you to execute various commands on your device from your computer. One of these commands lets you install apps on your Android device right from a Terminal or Command Prompt window on your computer.
The following guide is all about how you can use ADB to install new apps and remove existing apps from your device without leaving your machine. I’ll be using a Mac to perform the steps in the following guide. The steps will slightly vary for Windows and Linux users.
Download & Install ADB On Your Computer
ADB is a really great utility as it lets you perform a number of tasks on your device as long as your device is attached to your computer. You can install and uninstall apps, reboot the device into recovery mode, and perform a few other tasks on your device from your machine.
To
use ADB to install apps on your device, the first thing you’ll need
to do is download and set up the ADB tool on your computer. It is
available for all three major operating systems including Windows,
Mac, and Linux.
Head over to the ADB page on the official Android website and download the package for your operating system. Once it is downloaded, extract the files from the archive to your computer.
You
will get a few files in the extracted folder as shown above. You
don’t need to open any of these as you will be using Terminal to
work with these files.
Prepare The Device For ADB Communication
Now that the ADB tool is downloaded and all set up on your machine, you’ll need to prepare your Android device for ADB communication. By default, your device won’t be recognized on your machine as you need to first enable an option on the device.
- On your Android device, launch the Settings app and tap on About phone.
- You’ll see information about your phone on the following screen. Find and tap on the Build number option for about 7-8 times and it will say you’re a developer.
- Head back to the Settings app and you’ll find a new option saying Developer options. Get inside this new option and turn on the option that says USB debugging. This is the option that allows your device to communicate with your computer via ADB and it must be enabled whenever you use ADB.
Install An App Using ADB
Both
your device and your computer are now ready to work with ADB so let’s
start installing apps on your device using the tool.
- Plug in your Android device to your computer using a USB cable. If your device prompts you to select a connection mode, choose data transfer.
- If you are a Windows user, open the folder containing the ADB files, hold down the Shift key on your keyboard, right-click anywhere on your screen, and select Open a command window here.
- If you are a Mac user, launch the Terminal app, type cd, press the Spacebar, drag and drop the ADB folder onto your Terminal window, and finally hit Enter. Your ADB folder should now be the current working directory in Terminal.
- Type ./adb devices in the Terminal window and press Enter. It will list out all the ADB compatible devices attached to your machine. You’ll find your phone in this list of devices.
- Now that ADB recognizes your device, type ./adb install, press Spacebar, drag and drop your Android app APK file onto the Terminal window, and press Enter. It will install the selected app on your device.
Open
the app drawer on your device to confirm if the app is indeed
installed.
Using
this method, you can install as many apps as you want on your Android
device without leaving your computer.
Uninstall An App Using ADB
ADB
also lets you uninstall the apps installed on your device from your
computer but there’s a catch. You must know the package name of the
app that you want to uninstall from your device and it’s something
many of you may not be aware of.
Each
Android app has a package name but unfortunately you can’t find
them easily on your device. To help you out with the task, though,
there’s an app that lets you reveal the package name for all the
apps on your device.
Head over to the Google Play Store and download and install the App Inspector on your device. Launch it, select the app you want to uninstall using ADB, and you’ll see the app package name on your screen.
Get
back to the Terminal on your computer. Type ./adb uninstall,
press the Spacebar, enter the app package name, and hit Enter.
Your
chosen app will be uninstalled on your Android device.
If you’ve got lots of Android apps lying around on your computer, you can use the ADB tool to install those apps one by one on your device without having to transfer them to your device.