When using R8 on Android, do I need to uninstall my existing Proguard?
You don't actually remove the proguard rules, as R8 works with Proguard rules in compat mode. For more details, please refer to https://android-developers.googleblog.com/2018/11/r8-new-code-shrinker-from-google-is.html.
R8 is available with Android Studio 3.3 beta and works with Proguard rules. To try it, set the following in your project's
gradle.properties
file:android.enableR8=true
But for the full mode, it is not directly compatible with Proguard.
Edit #1
Check here for how to migrate Proguard to R8: Android/java: Transition / Migration from ProGuard to R8?
proguard-rules.pro does not seem to work with R8
Add this line to gradle.properties
android.enableR8 = true
And try below code inside your proguard-rules.pro
-keep public class ** {
public *;
protected *;
}
Edit #1
Check here for how to migrate Proguard to R8: Android/java: Transition / Migration from ProGuard to R8?
R8 FullMode Debug throwing Transition XXX is not a valid framework Transition or AndroidX Transition
It was a bug in R8. https://issuetracker.google.com/u/3/issues/241478253
Workaround for the issue is to add a proguard rule for:
- keep class androidx.transition.FragmentTransitionSupport
Android R8 not obfuscating class names
As per WorkManager's proguard file, it is expected that all classes that extend ListenableWorker
(and its subclasses, such as Worker
) are kept. This is because the name of the class is the unique key in WorkManager's internal database.
R8 issue: Unable to set up Proguard minifyEnabled because of error GC overhead limit exceeded
R8 is the new code shrinker from Google. If you are using Gradle plugin version 3.4.0 and above, R8 is on by default.
The issue occurs because R8 and Proguard don't work together properly.
Adding line to gradle.properties fixed it.
android.enableR8=false
Also, you may find this info useful https://www.reddit.com/r/androiddev/comments/bae6ny/r8_and_proguard/ekb4m7d/
proguard problem after updating to android gradle plugin 3.5
I should exclude cached objects from obfuscating but temporarily I disabled R8
and enabled proguard, by adding this line to gradle.properties
file:
android.enableR8=false
And adding this line to app build.gradle
file:
useProguard true
minifyEnabled true
And the problem solved.
Related Topics
How to Set Google Map Fragment Inside Scroll View
How to Save the Image to Sd Card on Button Click Android
How to Get Current Buildtype in Android Gradle Configuration
Executing Multiple Asynctask's Parallely
Checking a Checkbox in Listview Makes Other Random Checkboxes Checked Too
How to Stop Other Apps Playing Music from My Current Activity
Taking Screenshot Programmatically Doesnt Capture the Contents of Surfaceview
Android Make Animated Video from List of Images
Onclicklistener - X,Y Location of Event
Android Replace the Current Fragment with Another Fragment
How to Check Internal and External Storage If Exist
Open Android App from Url Using Intent-Filter Not Working
Error Type 3: Activity Class {...} Does Not Exist
How to Take Multiple Photos Before Dismissing Camera Intent
Save State of Activity When Orientation Changes Android
Volley Out of Memory Error, Weird Allocation Attempt
Android Simplecursoradapter Doesn't Update When Database Changes