From the course: Distributing Your Android App for Kotlin Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Minify the app with R8

Minify the app with R8 - Android Tutorial

From the course: Distributing Your Android App for Kotlin Developers

Start my 1-month free trial

Minify the app with R8

- [Instructor] One of the last things you should do before distributing your application is enable code and resource shrinking. The Android SDK comes packaged with a tightly integrated tool called R8 that is used to do exactly this. Doing this will reduce the final size of your application package and make it harder to decompile and read your code. Android used to use pro guard but this was replaced with R8 in 2018. In Android Studio, in the application, modules, build.gradle file, you can turn on code and resource shrinking by setting the minify enabled property to true. This is in the release build types section right above the line that specifies the pro guard configuration files that are used by R8. I have already adjusted this in the sample app. This will instruct the compiler to detect and remove unused classes, fields, methods, and attributes from your packaged application including those from reference…

Contents