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
27
votes
3 answers

How does DexGuard encrypt classes?

I want to check how DexGuard works but it seems that it doesn't have a free trial version. Can DexGuard encrypt an Android application? Or does it simply obfuscate the code? How does DexGuard encryption work? If you could provide code from a sample…
Arci
  • 6,647
  • 20
  • 70
  • 98
26
votes
5 answers

Android ProGuard Unable to access jarfile ..\lib\proguard.jar in IntelliJ 11.1

I have a problem about Unable to access jarfile ..\lib\proguard.jar when run Export Singed Application Package from IntelliJ 11.1. Environment: Run proguard is success in Android SDK r16. Run proguard is failed in Android SDK r17. The problem…
德耀 李
  • 261
  • 1
  • 3
  • 3
26
votes
2 answers

Obsolete proguard file; use -keepclasseswithmembers instead of -keepclasseswithmembernames

I am having the following error on proguard.cfg file in my android project. I dont know what this error says. Any idea?
Khawar Raza
  • 15,870
  • 24
  • 70
  • 127
26
votes
3 answers

How can I exclude external .jar from obfuscation by Proguard (Android project)?

When I export android project with proguard.cfg, all referenced .jar files are obfuscated as well. How can I exclude some of that .jars from obfuscation?
alex2k8
  • 42,496
  • 57
  • 170
  • 221
26
votes
6 answers

Google Drive API doesn't play well with ProGuard (NPE)

Currently, I'm having experience that, a piece of code, which makes use of Google Drive API is running fine without introducing ProGuard. However, after introducing ProGuard, I'm getting the following run-time error. at…
25
votes
2 answers

Android obfuscate app using proguard keeps obfuscating library jars - or is it?

I'm new to using Proguard so I'm probably making a newbie mistake. I've got an app that after I run the release build (which uses Proguard to obfuscate) it crashes pretty quickly. I believe I've narrowed it down to the fact that it seems like it…
bursk
  • 1,647
  • 7
  • 25
  • 39
25
votes
9 answers

ProGuard not working with okhttp

ProGuard won't play nice with okhttp and I keep getting the following Warnings: Warning:com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getContentLengthLong()' in program class…
wkarl
  • 781
  • 1
  • 8
  • 19
25
votes
2 answers

proguard.cfg file missing

Reading the docs on proguard . . . android docs I'm supposed to have a ProGuard.cfg as it says... "When you create an Android project, a proguard.cfg file is automatically generated in the root directory of the project. " If I google the issue there…
Dean Blakely
  • 3,535
  • 11
  • 51
  • 83
24
votes
5 answers

Proguard vs Annotations

I have an app that uses ActiveAndroid, a database ORM library, that relies on annotations. @Table(name="test") public class DatabaseItem extends ActiveRecordBase { public DatabaseItem(Context context) { super(context); …
Peterdk
  • 15,625
  • 20
  • 101
  • 140
24
votes
2 answers

android studio 3.5 Warning: The rule `-keep public class * extends androidx.versionedparcelable.VersionedParcelable { (); }` uses extends

Today, I updated my Android Studio to 3.5. After updated, I found below warning when I try to run the app. The rule -keep public class * extends androidx.versionedparcelable.VersionedParcelable { (); } uses extends but actually matches…
ZarNi Myo Sett Win
  • 1,353
  • 5
  • 15
  • 37
24
votes
4 answers

Error Proguard Unsupported class version number

I get always this erroe when I try to obfuscate an App with proguard Error:ProGuard: [MyApp] java.io.IOException: Can't read [C:\Program Files\Java\jdk1.8.0\jre\lib\rt.jar] (Can't process class [com/oracle/net/Sdp$1.class] (Unsupported class version…
AndreaF
  • 11,975
  • 27
  • 102
  • 168
24
votes
1 answer

What does the double asterisk mean in proguard rules?

What does this rule mean in proguard for example: -keep class myjava.** {*;} I understand {*;} part would mean all members and methods in the class. But what does the 2 asterisk mean in the package name?. Thanks in advance.
Notbad
  • 5,936
  • 12
  • 54
  • 100
24
votes
3 answers

* vs ** vs *** in Proguard?

What is the difference between the *, ** and *** wildcards in Proguard? For example: -keep class com.mypackage.* vs -keep class com.mypackage.** vs -keep class com.mypackage.***
J2K
  • 1,593
  • 13
  • 26
24
votes
4 answers

Android Proguard not removing all log messages

I want to create an obfuscated android application. I use ProGuard for that. I would like to automatically remove all the Log.* messages. How can I do that? I found this post but I still get them. (I use a decompiler to check the obfuscation). The…
Thomas Kaliakos
  • 3,274
  • 4
  • 25
  • 39
23
votes
8 answers

Proguard with OrmLite on Android

How should I use proguard with ormlite library on Android? Trying this: -keep class com.j256.** -keepclassmembers class com.j256.** -keep enum com.j256.** -keepclassmembers enum com.j256.** -keep interface com.j256.** -keepclassmembers interface…
sealskej
  • 7,281
  • 12
  • 53
  • 64