How To Install apksigner on Ubuntu 20.04

In this tutorial we learn how to install apksigner on Ubuntu 20.04. apksigner is command line tool to sign and verify Android APKs

Introduction

In this tutorial we learn how to install apksigner on Ubuntu 20.04.

What is apksigner

apksigner is:

apksig is a project which aims to simplify APK signing and checking whether APK’s signatures should verify on Android. apksig supports JAR signing (used by Android since day one) and APK Signature Scheme v2 (supported since Android Nougat, API Level 24).

The key feature of apksig is that it knows about differences in APK signature verification logic between different versions of the Android platform. apksig can thus check whether a signed APK is expected to verify on all Android platform versions supported by the APK. When signing an APK, apksig will choose the most appropriate cryptographic algorithms based on the Android platform versions supported by the APK being signed.

apksigner command-line tool offers two operations:

  • sign the provided APK so that it verifies on all Android platforms supported by the APK. Run apksigner sign for usage information.

  • check whether the provided APK’s signatures are expected to verify on all Android platforms supported by the APK. Run apksigner verify for usage information.

The tool determines the range of Android platform versions (API Levels) supported by the APK by inspecting the APK’s AndroidManifest.xml. This behavior can be overridden by specifying the range of platform versions on the command-line.

There are three methods to install apksigner on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install apksigner Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install apksigner using apt-get by running the following command:

sudo apt-get -y install apksigner

Install apksigner Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install apksigner using apt by running the following command:

sudo apt -y install apksigner

Install apksigner Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install apksigner using aptitude by running the following command:

sudo aptitude -y install apksigner

How To Uninstall apksigner on Ubuntu 20.04

To uninstall only the apksigner package we can use the following command:

sudo apt-get remove apksigner

Uninstall apksigner And Its Dependencies

To uninstall apksigner and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove apksigner

Remove apksigner Configurations and Data

To remove apksigner configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge apksigner

Remove apksigner configuration, data, and all of its dependencies

We can use the following command to remove apksigner configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge apksigner

References

Summary

In this tutorial we learn how to install apksigner package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.