When you consider installing an app on your Android smartphone, what is the first thing that comes to your mind? Google Play Store, right? Downloading and installing 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 files for software that can be downloaded using a web browser like chrome and then installed as and when required. The only requirement is that you enable the Unknown Sources permission 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.
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.