Questions tagged [proguard]

ProGuard is a tool to shrink, optimize, obfuscate, and preverify Java classes. It is included in the Android SDK.

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.

ProGuard is a command-line tool with an optional graphical user interface and with a plugin for Ant. ProGuard is integrated in Google's Android SDK, where it can be enabled for creating releases, from the command-line or in Eclipse. It is also supported in many development environments for Java Micro Edition.

Proguard is developed by Eric Lafortune and officially supported by GuardSquare.

4366 questions
32
votes
3 answers

How to minify a Flutter app with Proguard?

I already made a Flutter app. The release apk is about 14MB. I searched methods to minify this and found this ons: https://flutter.io/android-release/#enabling-proguard But my question is, how can I get to know all my used additional libraries for…
Jan D.M.
  • 2,284
  • 2
  • 20
  • 32
32
votes
3 answers

How can I check/upgrade Proguard version when using it in Eclipse for Android development?

The documentation on this is extremely poor. I understand that ProGuard can be enabled by manually editing "default.properties" in the project's rot directory. And all the settings go into the "proguard.cfg" file in the same place, but I'd like to…
user496854
  • 6,461
  • 10
  • 47
  • 84
32
votes
5 answers

can't generate signed APK from Android studio "Execution failed for task ':packageRelease'"

I am using Android Studio 1.2.2 and tried to generate APK with proguard setting. But I can't do it and got below error message. "Execution failed for task ':packageRelease'. Unable to compute hash of…
김재형
  • 479
  • 1
  • 4
  • 10
32
votes
6 answers

proguard warning: the configuration keeps the entry point....but not the descriptor class

I've configured: -keep ,allowoptimization,allowobfuscation,allowshrinking public class org.jf.dexlib2.dexbacked.** { *; } but still getting the warning: Note: the configuration keeps the entry point 'com.trusteer.trf.dex_parser { int…
user3398598
  • 423
  • 1
  • 5
  • 10
31
votes
4 answers

Removing unused strings during ProGuard optimisation

I include this ProGuard configuration to strip out debug log statements when I release an Android application: -assumenosideeffects class android.util.Log { public static *** d(...); public static *** v(...); } This works as expected — I…
Christopher Orr
  • 110,418
  • 27
  • 198
  • 193
31
votes
2 answers

How to tell proguard to keep enum constants and fields

I've try obfuscate our web application which use spring, jaxb and relies on annotations, and reflection heavily. I apply many recipes found in internet to keep some classes, attributes, annotations and enumerations. But with enumerations still have…
Hubbitus
  • 5,161
  • 3
  • 41
  • 47
31
votes
2 answers

Android Studio proguard handling in multi-library projects

I have an application that uses an externally referenced library (that is, the directory of the library is in the same level as the application - it is not copied inside the application's folder). The library is referenced by the application and…
a.p.
  • 3,248
  • 7
  • 30
  • 48
31
votes
2 answers

How to include a proguard configuration in my Android library (AAR)

Android libraries, per the AAR file spec, includes a 'proguard.txt' file. My understanding is that this file declares how the library correctly can be obfuscated and minified. In my case I need to preserve some API-classes. How can I declare the…
Per Christian Henden
  • 1,514
  • 1
  • 16
  • 26
31
votes
3 answers

Does Proguard guarantee to provide the same mapping if no source has changed?

In the case, if I will build a project clean up all binaries build it again (no source/resources and etc has changed). Does Proguard guarantee to provide the same mapping.txt file?
Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
30
votes
3 answers

How to setup PROGUARD for Jackson JSON Processor?

I am using Jackson JSON Processor for my app.Included this using compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2' compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.2'. And my proguard configuration is. ## BEGIN -- Google Play…
williamj949
  • 11,166
  • 8
  • 37
  • 51
30
votes
1 answer

What is the difference between -keep and -keepclassmembers in ProGuard?

I read through http://proguard.sourceforge.net/index.html#manual/usage.html but cannot get their differences. I tested with 2 different options and decompiled the outcome. Both seems to produce the same result. -keep class * implements…
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
29
votes
2 answers

In proguard, how to preserve a set of classes' method names?

I am using proguard to obfuscate my android application. The android application contains some native code, which makes callbacks to fully qualified java methods. I need to not obfuscate these classes and the names of their methods. The below…
ab11
  • 19,770
  • 42
  • 120
  • 207
29
votes
8 answers

Proguard Missing classes detected while running R8 after adding package names in proguard-rules.pro

AGPBI gives this as output: > Task :app:minifyReleaseWithR8 AGPBI: {"kind":"warning","text":"Unexpected reference to missing service class:…
Jim Clermonts
  • 1,694
  • 8
  • 39
  • 94
29
votes
2 answers

Proguard won't keep a class member's enums

I'm working on a library that is distributed as a java jar, and I'm running proguard on it in such a way as to only leave the required interfaces exposed. I have a configuration class with a bunch of member variables and some enum defines. My…
Jesse
  • 403
  • 1
  • 5
  • 5
29
votes
4 answers

Android Unit Tests with proguard enabled

I have a problem that Proguard strips out methods of my debug APK (I need to run proguard on debug beccause of method dex file limit), even if they are used in the Test apk. E.g. i use GSON addProeprty method in Unit test, but not in the App apk. …
Denny1989
  • 639
  • 1
  • 9
  • 15