Running out of space? That's no longer a problem!

Google’s code shrinker R8 promises to reduce APK size in Android apps

Jane Elizabeth
© Shutterstock / polymanu

Reducing your footprint has never been easier! Save space and increase user engagement with Google’s new code shrinker, R8! Now a part of Android Studio 3.3, this code shrinker promises to optimize your apps for a lighter APK.

Any mobile developer worth their salt knows that the goal of the game is to reduce their app’s footprint as much as possible. Even as our phone’s available memory is now measured in the GB, we’re still running out of space thanks to the countless number of photos, music, and apps we’ve got on there.  Anything to reduce an apps size can only increase user engagement.

Introducing R8, the latest code shrinker from Google. Now a part of the Android Studio 3.3 beta, this code shrinker is designed to help reduce the size of your app’s APK. Code shrinking gets rid of unused code and resources. It also optimizes how your code is stored, making sure it takes up less space.

R8 shrinks, desurgars, and dexes in one step. It even does so faster than Android’s current standard, Proguard, with a more efficient output size. Basically, it detects and removes unused classes, fields, methods, and attributes from your packaged app. It even goes through the included code libraries to sift through unused files, making it easier for developers to get around the 64k reference limit.

Resource shrinking, in general, is aimed optimizing bytecode, removing unused code instructions, and obfuscating the remaining classes, fields, and methods with short names. This shaves the app footprint down to the bone, making it light as a feather.

SEE MORE: Android Studio 3.0: Kotlin support, new Android plugin for Gradle and more

Want to try R8?

R8 a part of the Android Studio 3.3 beta and enabled by default, available now here. For more information, see the release notes here.

It currently works with Proguard rules, but there is also a full mode that isn’t directly compatible. This full mode provides even more optimizations to reduce app size.

However, R8 does not currently support Android Archive Library (AAR) projects. It is only used when building APK files. R8 is the planned default code shrinker in Android Studio for future releases.

Jane Elizabeth
Jane Elizabeth is an assistant editor for

Inline Feedbacks
View all comments