How do you keep all classes in ProGuard?

-keepclassmembernames. This is the most permissive keep directive; it lets ProGuard do almost all of its work. Unused classes are removed, the remaining classes are renamed, unused members of those classes are removed, but then the remaining members keep their original names.

What does ProGuard keep do?

ProGuard is a tool to help minify, obfuscate, and optimize your code. It is not only especially useful for reducing the overall size of your Android application as well as removing unused classes and methods that contribute towards the intrinsic 64k method limit of Android applications.

Does ProGuard remove unused classes?

Helps to remove unused classes, members & fields. It removes unused codes from your libraries as well. (Which means, any method or field that is not referenced anywhere will be removed by ProGuard Shrinker). Helps to reduce the build size by obfuscating the classes, methods, & fields with short names.

Should I use R8 or ProGuard?

R8 is more effective in inlining container classes and slightly more aggressive in removing unused classes, fields, and methods. For example, processing ProGuard 6.1. 1 itself, R8 achieves a size reduction of about 10%, compared to ProGuard’s 8.5%….Optimizations.

Optimization ProGuard R8
Peephole optimizations 520 6

How can I force ProGuard to keep my .XML resource file?

You’ll need to manually add a copy action to the build. xml for the resource files to be copied to the output dir.

What does minifyEnabled do?

minify is an Android tool that will decrease the size of your application when you go to build it. It’s extremely useful as it means smaller apk files! It detects any code or libraries that aren’t being used and ignores them from your final apk.

Where do you put ProGuard rules?

R8 configuration files

Source Location
Android Studio /proguard-rules.pro
Android Gradle plugin Generated by the Android Gradle plugin at compile time.
Library dependencies AAR libraries: /proguard.txt JAR libraries: /META-INF/proguard/

Is ProGuard free?

ProGuard is free software and is distributed under the GNU General Public License, version 2. ProGuard is distributed as part of the Android SDK and runs when building the application in release mode.

Does ProGuard improve performance?

Most of the bytecode optimizations that ProGuard does are done just as well or better by any mainstream JVM’s JIT, so for those you shouldn’t expect significant improvements (except for class loading). Show activity on this post. The main benefit, from our experience, is that it can protect your intellectual rights.

What is R8 and d8?

D8 is a dexer that converts java byte code to dex code. R8 is a java program shrinking and minification tool that converts java byte code to optimized dex code. It seems both converts java byte code to dex code literally.

What is Dontwarn in ProGuard?

-dontwarn [class_filter] Specifies not to warn about unresolved references and other important problems at all. The optional filter is a regular expression; ProGuard doesn’t print warnings about classes with matching names. Ignoring warnings can be dangerous.

What is ProGuard mapping file?

A mapping file contains the original names and the obfuscated names of classes, fields, and methods. ProGuard can write out such a file while obfuscating an application or a library, with the option -printmapping . ReTrace requires the mapping file to restore obfuscated stack traces to more readable versions.

Is there a 10 year old version of ProGuard?

EDITThis answer is 10 years old – it may not apply to newer proguard versions. I think you need to add these flags at the very least (modify for you individual package names):

How many classes are there in ProGuard for Android?

Building with ProGuard ignores android.app.* classes 67 Android proguard, keep inner class 4 Use Proguard for stripping unused Support lib classes 529 How to correctly save instance state of Fragments in back stack?

Does ProGuard remove anything from my package?

With the default ProGuard configuration which Eclipse generates ProGuard removes many things – OnClick methods, static members, callback methods which my native library uses… Is it there a simple way to instruct ProGuard to NOT remove anything from my package?

Does ProGuard remove onclick methods from my application?

My application has many activities and uses native library too. With the default ProGuard configuration which Eclipse generates ProGuard removes many things – OnClick methods, static members, callback methods which my native library uses… Is it there a simple way to instruct ProGuard to NOT remove anything from my package?