Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is r8 enabled on existing project after updating Android studio?

I updated Android studio and if I'm correct the update includes R8 by default to my projects. The question is is r8 only activated by default on new projects or did the update include that change also to my already created project? If not how can I make use of it.

like image 433
Yava Avatar asked Apr 23 '19 20:04

Yava


People also ask

Is R8 enabled by default?

By default, R8 is present in Android Studio. All we need is to enable it. To enable R8, open build. gradle module app file and add this piece of code inside the buildTypes .

What is R8 Android studio?

What is R8? R8 is an app shrinking tool that is used to reduce the size of your application. This tool present in Android Studio works with the rules of Proguard. R8 will convert your app's code into optimized Dalvik code.

What does minifyEnabled do?

So minifyEnabled removes dead code but does not obfuscate or optimize.


1 Answers

In Android Studio 3.4, R8 is used by default for all projects that don't disable it. You can switch to Proguard with:

  • android.enableR8 = false in gradle.properties; or
  • useProguard = true in your build.gradle.

In Android Studio 3.5, the useProguard flag has no effect. That means that R8 is always used, unless you add android.enableR8=false in gradle.properties.

like image 197
Ian Zerny Avatar answered Sep 20 '22 19:09

Ian Zerny