Obfuscation, code shrinking and optimization
Obfuscation is carried out during the optional build step of shrinking an app to remove unused code and resources. It protects the app by making it difficult to reverse engineer or debug while leaving it semantically identical to the original. It is usually only performed on the release version of an app, enabling you to continue to debug your app during development. Obfuscation may impact your app's performance, so it is necessary to measure the performance to determine whether further configuration is needed to mitigate any issues.
Two tools are available for shrinking and obfuscating an app: the Android default Google R8 tool, and the NAGRA KOP4J plugin. These pages describe how to enable each of these, leaving the fine details to the official documentation.