Shrink, Optimize and Secure Your App With R8 & ProGuard - Full Guide

Philipp Lackner · 79K views · 2021 · 18:08

Open on YouTube

Software performance & optimizationTesting, debugging & developer toolstutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about code shrinking, obfuscation and minifyEnabled breaking release builds, since it walks through R8 setup and @Keep rules.

Recommended by 3 people across 3 different months, 2021 to 2023.

What it is

A tutorial by Android developer Philipp Lackner on preparing an Android app for release using R8 and ProGuard. It covers enabling R8, writing ProGuard rules and using the @Keep annotation, building the release version, and reading obfuscated stack traces.

What people said

Strong rec Zaid Zakir · 2021-06 · Stack Overflow · on “Obufscation, shrinking using build.gradle in Android”

Hi there in the new android version it's not necessary to use "useProguard true" anymore. when you build your project using Android Gradle plugin 3.4.0 or higher, the plugin no longer uses ProGuard to shrink your code. Instead, the plugin works with the R8 compiler by default to handle the responsibility of Shrinking, obfuscating, and optimizing your app. However you still need the proguard file to mention your rules. [this video] One of the best videos on this topic in my opinion , watch this if you can.

Recommends Naresh Pradhan · 2023-03 · Stack Overflow · on “Android app downloading NULL data from remote mysql db”

I got the answer after a long search. The issue was with minifyEnabled = true option in build.gradle file. Make it false , so that android won't obfuscate the code, column names before sending it to database. But again, making it false is not good for app as others can decode and see your code from google Play Store. That's why make minifyEnabled = true and use a proper R8 technique by adding @Keep keyword in your code functions. For more details, watch this video: [this video]

Recommends Ayman Ait · 2023-10 · Stack Overflow · on “Why apps made in Jetpack compose are larger. Any Solution?”

@Bharath_king77 Sure! Here is a video from Philipp lackner explaining the benefits and how to use it. [this video]