当您考虑在Android智能手机上安装应用程序时,您首先想到的是什么?Google Play 商店(Google Play Store),对吧?从Play 商店(Play Store)下载和安装应用程序是最简单的方法。但是,它肯定不是唯一的方法。好吧(Well),对于初学者来说,您始终可以选择从他们的APK文件安装应用程序。这些文件就像软件的安装文件,可以使用 chrome 等网络浏览器下载,然后在需要时安装。唯一的要求是您为浏览器启用未知(Unknown) 来源权限。(Sources)
现在,所描述的方法要求您可以直接访问您的设备,但要考虑某些系统文件意外损坏的情况。这会导致您的 UI 崩溃并让您无法访问您的手机。解决此问题的唯一方法是安装第三方 UI 应用程序,以便设备重新开始工作。这就是ADB的用武之地。它允许您使用计算机控制您的设备。这是在这种情况下您可以在设备上安装应用程序的唯一方法。
好吧,这只是亚行(ADB)可以成为救命稻草的众多场景之一。因此,如果您对亚行(ADB)有更多的了解并学会如何使用它,那只会对您有好处,而这正是我们要做的。我们将讨论什么是亚行(ADB)及其运作方式。我们还将引导您完成设置过程中涉及的各个步骤,然后使用ADB在您的设备上安装应用程序。
如何使用 ADB 命令安装 APK(How to Install APK Using ADB Commands)
什么是亚行?(What is ADB?)
ADB代表Android 调试桥(Android Debug Bridge)。它是一个命令行工具,是Android SDK(软件开发工具包(Software Development Kit))的一部分。它允许您使用 PC 控制您的Android智能手机,前提是您的设备通过USB电缆连接到计算机。您可以使用它来安装或卸载应用程序、传输文件、获取有关网络或 Wi-Fi 连接的信息、检查电池状态、截取屏幕截图或屏幕录制等等。它有一组代码,可让您在设备上执行各种操作。事实上,亚行(ADB)是一个非常强大的工具,能够执行经过大量实践和培训才能掌握的高级操作。您对编码世界的探索越多,ADB对您就越有用。但是,为了简单起见,我们只介绍一些基础知识,主要教您如何(how to install an APK)使用 ADB 安装 APK。
它是如何工作的?(How does it work?)
ADB使用USB调试来控制您的设备。当使用USB数据线连接到计算机时, A DB(ADB)客户端能够检测到连接的设备。它使用命令行或命令提示符作为媒介在计算机和Android设备之间传递命令和信息。有一些特殊的代码或命令可让您控制Android设备上的进程和操作。
使用 ADB 的各种先决条件是什么?(What are the various Pre-requisites for using ADB?)
现在,在使用 ADB 命令安装 APK 之前,( install APK using ADB commands,)您需要确保满足以下先决条件。
1. 您需要的第一件事是确保您的 PC 上安装了设备的驱动程序。每个Android智能手机都带有自己的设备驱动程序,当您将手机连接到 PC 时会自动安装该驱动程序。如果您的设备没有,则需要单独下载驱动程序。对于像Nexus这样的(Nexus)谷歌(Google)设备,你可以找到只是安装谷歌 USB 驱动程序(Google USB Driver),它是SDK的一部分(我们将在后面讨论)。三星(Samsung)、HTC、摩托罗拉(Motorola)等其他公司在各自的网站上提供驱动程序。
2.接下来你需要在你的Android智能手机上启用USB调试。可以在开发人员(Developer)选项下找到这样做的选项。首先(First),从设置菜单中启用开发人员选项。(enable the Developer Options)
之后,您需要从开发人员选项中启用 USB 调试。(enable USB debugging)
一种。打开设置(Settings),然后单击系统(System)选项。
湾。现在,点击开发者选项(Developer options)。
C。向下滚动并在调试部分(Debugging section)下,您将找到USB 调试(USB debugging)的设置。只需(Simply)打开开关,您就可以开始了。
3. 最后但同样重要的是,您需要在计算机上下载并安装ADB。我们将在下一节讨论这个问题,并指导您完成整个安装过程。
如何在 Windows 上下载和安装 ADB?(How to Download and Install ADB on Windows?)
如前所述,ADB是Android SDK的一部分,因此,您需要下载工具包的整个安装包。请按照以下步骤在 Windows 10 上下载并安装 ADB(download and install ADB on Windows 10):
1. 点击此处(here)进入Android SDK平台工具下载页面。
2. 现在,点击“Download SDK Platform-Tools for Windows”按钮。您也可以根据您使用的操作系统选择其他选项。
3. 同意条款和条件并点击下载按钮(Terms and Conditions and click on the Download button)。
4. 下载 zip 文件后,将其解压缩到您要保存工具包文件的位置。
您将能够看到文件夹中的“ ADB ”以及其他工具。安装过程现已完成。我们现在将进入下一步,使用ADB在您的设备上安装APK 。
如何使用 ADB 在您的设备上安装 APK?(How to Use ADB to install APK on your device?)
在继续使用ADB命令安装(ADB)APK之前,您需要确保正确设置 ADB 并且正确检测到连接的设备。(ADB is set up properly and the device connected is being detected properly.)
1. 为此,请将您的Android设备连接到计算机,然后打开包含SDK平台工具的文件夹。
2. 在该文件夹中,按住Shift 键,然后右键单击(down Shift and then right-click)。从菜单中选择“在此处打开命令窗口(Open Command window here)”选项。如果打开命令窗口的选项不可用,请单击“在此处打开 PowerShell 窗口(Open PowerShell window here)”。
3. 现在,在命令提示符(Command Prompt)窗口/PowerShell 窗口中键入以下代码:“ . .\adb devices ”并按 Enter。
4. 这将在命令窗口中显示您的设备名称。
5. 如果没有,则设备驱动程序有问题。
6. 这个问题有一个简单的解决方案。转到计算机上的搜索栏并打开设备管理器。(Device Manager.)
7. 您的 Android 设备将在此处列出。右键单击(Right-click)它,然后只需点击更新驱动程序选项。(update driver option.)
8.接下来,单击选项以在线查找驱动程序(Drivers)。如果有任何可用的新驱动程序,它们将自动下载并安装(automatically get downloaded and installed)在您的计算机上。
9. 现在,返回command prompt/PowerShel l 窗口并键入上面提供的相同命令,然后按Enter。您现在将能够看到屏幕上显示的设备名称。
这确认ADB已成功设置并且您的设备已正确连接。您现在可以使用ADB命令在手机上执行任何操作。这些命令需要在命令提示符(Command Prompt)或PowerShell窗口中输入。为了通过ADB在您的设备上安装APK,您需要将APK文件存储在您的计算机上。假设我们正在为VLC媒体播放器安装APK文件。
请按照以下步骤在您的设备上安装该应用程序:
1. 首先需要将 APK 文件移动到 SDK 平台工具所在的文件夹中。(move the APK file to the folder containing the SDK platform tools.)这将使您更容易,因为您不必单独键入APK文件位置的完整路径。
2. 接下来,打开命令提示符窗口或PowerShell窗口并输入以下命令:“ adb install <app name.apk> ”其中应用程序名称是APK文件的名称。在我们的例子中,它将是“ VLC.apk ”
3. 安装完成后,您将能够在屏幕上看到“成功”消息。(Success)
受到推崇的:(Recommended:)
因此,您现在已经成功学习了如何使用 ADB 命令安装 APK( how to install APK using ADB commands)。但是,如上所述,ADB是一个强大的工具,可用于执行各种其他操作。您只需要知道正确的代码和语法,您就可以做更多的事情。在下一节中,我们为您准备了一点小红包。我们将列出某些选定的重要命令,您可以尝试并从中获得乐趣。
其他重要的 ADB 命令(Other Important ADB Commands)
1. “adb install -r <app name.apk>” – 此命令允许您重新安装或更新现有应用程序。例如,您已经在设备上安装了一个应用程序,但您希望使用该应用程序的最新APK文件更新该应用程序。当系统应用程序损坏并且您需要使用其APK文件替换损坏的应用程序时,它也很有用。
2. “adb install -s <app name.apk>” – 此命令允许您在 SD 卡上安装应用程序,前提是该应用程序兼容安装在 SD 卡上,并且如果您的设备允许在 SD 卡上安装应用程序SD 卡。
3. “adb uninstall <app name.apk>” – 此命令允许您从设备中卸载应用程序,但是需要记住的一件事是您需要在卸载时输入整个包名称应用程序。例如,您需要编写“com.instagram.android”才能从您的设备上卸载Instagram 。
4. “adb logcat”——这个命令允许你查看设备的日志文件。
5. “adb shell”——这个命令允许你在你的(5. “adb shell” – )安卓(Android)设备上打开一个交互式的Linux命令行 shell 。
6. “adb push <file location path>/sdcard/<folder name>” – 此命令允许您将计算机上的一些文件传输到Android设备的SD卡。这里的“文件位置路径”代表文件在您计算机上的路径,“文件夹名称”是文件将在您的Android设备上传输的目录。
7. “adb pull /sdcard/<file name><file location path>” – 这个命令可以认为是push命令的逆。它允许您将文件从Android设备传输到计算机。您需要输入 SD 卡上文件的名称来代替“文件名”。在计算机上指定要保存文件的位置,而不是“文件位置路径”。
8. “adb reboot” -此命令允许您重新启动设备。您还可以通过在重启后添加 -bootloader 来选择在 bootloader 中启动您的设备。某些设备还允许您通过键入“重新启动恢复”而不是简单地重新启动来直接启动到恢复模式。(Recovery)
How to Install APK Using ADB Commands
When you cоnsider installіng an aрp on your Android smartphone, what is the first thing that comes to yоur mind? Goоgle Play Store, right? Downloading and іnstalling an app from the Play Store is the simplest and easiest method to do so. However, it most certainly isn’t the only method. Well, for starters, you always have the option to install apps from their APK files. These files are like setup fіles for software that can be downloaded using a web browser like chrome and then installed as аnd when required. The only requirement is that you enable the Unknown Ѕources pеrmission for your browser.
Now, the described method requires you to have direct access to your device but consider a situation where accidentally some system file gets damaged. This causes your UI to crash and leaving you with no way to access your phone. The only way to resolve the issue is to install a third-party UI app so that the device starts working again. This is where ADB comes in. It allows you to control your device using a computer. It is the only way in which you can install apps on your device in a situation like this.
Well, this is just one of many scenarios where ADB could be a lifesaver. Therefore, it would only do you good if you knew more about ADB and learned how to use it and that’s exactly what we are going to do. We are going to discuss what is ADB and how it works. We will also take you through the various steps involved in the process of setting up and then using ADB to install apps on your device.
How to Install APK Using ADB Commands
What is ADB?
ADB stands for Android Debug Bridge. It is a command-line tool that is a part of the Android SDK (Software Development Kit). It allows you to control your Android smartphone using a PC provided that your device is connected to the computer via a USB cable. You can use it to install or uninstall apps, transfer files, get information about network or Wi-Fi connection, check battery status, take screenshots or screen recording and so much more. It has a set of codes that allow you to perform various operations on your device. As a matter of fact, ADB is a very powerful tool that is capable of performing advanced operations that a good amount of practice and training to master. The more you explore the world of coding, the more useful ADB will become for you. However, for the sake of keeping things simple, we are just going to cover some basics and mainly teach you how to install an APK using ADB.
How does it work?
ADB uses USB debugging to take control of your device. When connected to a computer using a USB cable, ADB client is able to detect the connected device. It uses a command line or command prompt as the medium to relay the commands and information between the computer and the Android device. There are special codes or commands which allow you to control the processes and operations on your Android device.
What are the various Pre-requisites for using ADB?
Now, before you can install APK using ADB commands, you need to make sure the following pre-requisites are met.
1. The first thing that you need is to make sure that the device’s driver is installed on your PC. Every Android smartphone comes with its own device driver that automatically gets installed when you connect your phone to your PC. If your device does not have one then you need to download the driver separately. For Google devices like Nexus, you can find just install Google USB Driver which is a part of SDK (we will discuss this later). Other companies like Samsung, HTC, Motorola, etc. provide drivers on their respective sites.
2. The next thing that you need is to enable USB debugging on your Android smartphone. The option to do so can be found under Developer options. First, enable the Developer Options from the Settings menu.
After that, you need to enable USB debugging from the Developer options.
a. Open Settings and click on the System option.
b. Now, tap on Developer options.
c. Scroll down and under the Debugging section, you will find the setting for USB debugging. Simply toggle on the switch and you are good to go.
3. Last but not least, you need to download and install ADB on your computer. We will discuss this in the next section and guide you through the entire installation process.
How to Download and Install ADB on Windows?
As mentioned earlier, ADB is a part of the Android SDK and thus, you need to download the entire setup package for the tool kit. Follow the steps given below to download and install ADB on Windows 10:
1. Click here to go to the downloads page for Android SDK platform tools.
2. Now, click on the “Download SDK Platform-Tools for Windows” button. You can select the other options as well depending upon the operating system that you are using.
3. Agree to the Terms and Conditions and click on the Download button.
4. Once the zip file is downloaded, extract it at a location where you want to save the tool kit files.
You will be able to see the ‘ADB’ present in the folder along with other tools. The installation process is now complete. We will now be moving to the next step that is using ADB to install APK on your device.
How to Use ADB to install APK on your device?
Before you proceed to install APK using ADB commands, you need to make sure that ADB is set up properly and the device connected is being detected properly.
1. To do this, connect your Android device to the computer and then open the folder containing the SDK platform tools.
2. In this folder, hold down Shift and then right-click. From the menu select the “Open Command window here” option. If the option to open the command window is not available, then click on the “Open PowerShell window here”.
3. Now, in the Command Prompt window/PowerShell window type the following code: “.\adb devices” and press Enter.
4. This will display the name of your device in the command window.
5. If it does not, then there is a problem with the device’s driver.
6. There is a simple solution to this problem. Go to the search bar on your computer and open Device Manager.
7. Your Android device will be listed there. Right-click on it and simply tap on the update driver option.
8. Next, click on the option to look for Drivers online. If there are any new drivers available then they will automatically get downloaded and installed on your computer.
9. Now, go back to command prompt/PowerShell window and type the same command provided above and press Enter. You will now be able to see the name of the device displayed on the screen.
This confirms that ADB has been successfully set up and your device is connected properly. You can now perform any operations on your phone using the ADB commands. These commands need to be entered in the Command Prompt or PowerShell window. In order to install an APK on your device via ADB, you need to have the APK file stored on your computer. Let us assume that we are installing the APK file for the VLC media player.
Follow the steps given below to install the app on your device:
1. The first thing that you need to do is move the APK file to the folder containing the SDK platform tools. This will make it easier as you would not have to type the entire path for the location of the APK file separately.
2. Next, open the command prompt window or PowerShell window and type in the following command: “adb install <app name.apk>” where the app name is the name of the APK file. In our case, it will be “VLC.apk”
3. Once the installation is complete, you will be able to see the message “Success” displayed on your screen.
Recommended:
Thus, you have now successfully learned how to install APK using ADB commands. However, as mentioned above ADB is a powerful tool and can be used to perform various other operations. All that you need to know is the correct code and syntax and you will be able to do so much more. In the next section, we have a little bonus for you. We will be listing down certain selected important commands that you can try and have fun experimenting with.
Other Important ADB Commands
1. “adb install -r <app name.apk>” – This command allows you to re-install or update an existing app. Take for example you already have an app installed on your device but you wish to update the app using the latest APK file for the app. It is also useful when a system app is corrupted and you need to replace the corrupted app using its APK file.
2. “adb install -s <app name.apk>” – This command allows you to install an app on your SD card provided the app is compatible to be installed on the SD card and also if your device allows apps to be installed on the SD card.
3. “adb uninstall <app name.apk>” – This command allows you to uninstall an app from your device, However, one thing that needs to be kept in mind is that you need to type in the entire package name while uninstalling an app. For example, you need to write “com.instagram.android” in order to uninstall Instagram from your device.
4. “adb logcat” – This command allows you to view the device’s log files.
5. “adb shell” – This command allows you to open an interactive Linux command-line shell on your Android device.
6. “adb push <file location path>/sdcard/<folder name>” – This command allows you to transfer some file on your computer to the SD card of your Android device. Here “file location path” stands for the pathway of the file on your computer and “folder name” is the directory where the file will get transferred on your Android device.
7. “adb pull /sdcard/<file name><file location path>” – This command can be considered to be the reverse of push command. It allows you to transfer a file from your Android device to your computer. You need to type in the name of the file on your SD card in place of “filename”. Specify the location on your computer where you want to save the file in place of “file location path”.
8. “adb reboot” – This command allows you to restart your device. You can also select to boot your device in bootloader by adding -bootloader after reboot. Some devices also allow you to directly boot into Recovery mode by typing “reboot recovery” instead of simply reboot.