aapt2 command not found

In this troubleshooting guide we learn how to fix aapt2 command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

aapt2: command not found

or when using sudo you get the following error message

sudo: aapt2: command not found

Solutions to aapt2: command not found

How To Fix aapt2: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu aapt2 is provided by aapt package.

aapt is:

The Android Asset Packaging Tool (aapt) takes your application resource files, such as the AndroidManifest.xml file and the XML files for your Activities, and compiles them. An R.java is also produced so you can reference your resources from your Java code. This tool allows you to view, create, and update Zip-compatible archives (zip, jar, apk). It can also compile resources into binary assets.

To fix this problem, we can install more using the command below.

sudo apt-get -y install aapt

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install aapt.

sudo apt -y install aapt

Or if you have aptitude installed you can use the following command.

sudo aptitude install aapt

Summary

In this tutorial we learn how to fix aapt2 command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.