In the link phase, AAPT2 merges all the intermediate files generated from the compilation phase such as resource tables, binary XML files, and processed PNG files and packages them into a single APK.

Additionally, other auxiliary files like and Pro Guard rules files can be generated during this phase.

That is, when passing whole directories, AAPT2 recompiles all files in the directory even when only one resource has changed.

The output file types can differ based on the input you provide for compilation.

You can also debug build errors related to AAPT2 from the command line.

To do so, you can find AAPT2 as a standalone tool in Android SDK Build Tools 26.0.2 and higher.

Enabling this option results in a faster execution, but increases the output file size.

Treats errors that are permissible when using earlier versions of AAPT as warnings.

For example, if you have dependencies on the support library (which contains translations for multiple languages), you can filter resources just for the given language configuration, like English or Spanish.

You must define the language configuration by a two-letter ISO 639-1 language code, optionally followed by a two letter ISO 3166-1-alpha-2 region code preceded by lowercase 'r' (for example, en-r US).

However, the generated APK does not contain DEX bytecode and is unsigned.

That is, you can't deploy this APK to a device.

When you invoke AAPT2 for compilation, you should pass a single resource file as an input per invocation.