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
80
votes
7 answers

AssertionError in Gson EnumTypeAdapter when using Proguard Obfuscation

My project implements a TypeAdapter in Gson during serialization/deserialization for preserving object's polymorphism state. Anyhow, the project works fine during development tests, but when it is released with proguard obfuscation and tested, it…
waqaslam
  • 67,549
  • 16
  • 165
  • 178
79
votes
9 answers

appcompat-v7 v21.0.0 causing crash on Samsung devices with Android v4.2.2

We just changed our application to use the appcompat-v7 support library in order to take advantage of the support actionbar and support Material themes. Using v21.0.0 of appcompat-v7 (andv21.0.0 of support-v4), we are now seeing crashes in Google…
72
votes
5 answers

How to debug with obfuscated (with ProGuard) applications on Android?

When I got something like this ERROR/AndroidRuntime(18677): Caused by: java.lang.NullPointerException ERROR/AndroidRuntime(18677): at com.companyname.a.a.a(Unknown Source) How can I know where the problem is and debug this issue? I only got the…
shiami
  • 7,174
  • 16
  • 53
  • 68
72
votes
3 answers

Android ProGuard: Most Aggressive Optimizations

Android's official proguard documentation shows two primary optimizations: set minifyEnabled to true use proguard-android-optimize.txt instead of proguard-android.txt Are these two the most aggressive possible settings? I am writing an android…
lf215
  • 1,185
  • 7
  • 41
  • 83
72
votes
4 answers

ProGuard: can't find referenced class com.google.android.gms.R

After some updates in Android SDK manager I try make signed apk and get this: ProGuard: [] Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced class com.google.android.gms.R ProGuard: [] Warning:…
Bred P.
  • 786
  • 1
  • 5
  • 8
69
votes
6 answers

Android proguard, keep inner class

My android program has a class A, which has two static inner class. They are found to be stripped from .dex after applying proguard. public class A{ ... static class B{ ... } static class C{ ... } } I have put the following…
David Guan
  • 809
  • 1
  • 8
  • 13
68
votes
6 answers

Unresolved class name proguard-rules Android Studio 4.0

When I update to Android Studio 4.0 proguard-rules it shows warning Unresolved class name. Below is example but I sure it still waring the exist class in my project. -keep class com.squareup.haha.** { *; } -keep class com.squareup.leakcanary.** { *;…
Công Hải
  • 4,961
  • 3
  • 14
  • 20
66
votes
3 answers

Android: What are the recommended configurations for Proguard?

I'm developing apps for Android and using Proguard to obfuscate the code. Currently i'm using ProGuard configurations: -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations…
neteinstein
  • 17,529
  • 11
  • 93
  • 123
62
votes
7 answers

Hiding strings in Obfuscated code

I just Obfuscated my Android code using proguard and then decompiled it. There are a number of strings I would really like to hide from prying eyes. When I decompiled my code the strings were there for everyone to see...and change. One of the…
jax
  • 37,735
  • 57
  • 182
  • 278
60
votes
3 answers

How to tell ProGuard to keep everything in a particular package?

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…
ggurov
  • 1,496
  • 2
  • 15
  • 21
58
votes
3 answers

How to make Proguard ignore external libraries?

I want to use Proguard mainly for obfuscation reasons. My problem is that I have three libraries, Twitter4J and two signpost libraries. These libraries caused errors when I tried to create an signed APK. To get over this I put the following in the…
Mel
  • 6,214
  • 10
  • 54
  • 71
54
votes
5 answers

Android - How to check Proguard obfuscation has worked?

I have obfuscated my apk, but the file size has only been reduced from 12MB to 10.5MB. The reason it is only a relatively small reduction may be because my app uses a couple of large libraries, but is there any way I can check the level of…
ban-geoengineering
  • 18,324
  • 27
  • 171
  • 253
54
votes
5 answers

proguardRelease FAILED when compiling apk with assembleRelease in Android Studio

I'm trying to compile my app as assembleRelease in Android Studio 1.0.1 and get the following message: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:proguardRelease'. > java.io.IOException: Please…
jul
  • 36,404
  • 64
  • 191
  • 318
54
votes
12 answers

What ProGuard configuration do I need for Firebase on Android?

When using the Firebase SDK for Android apps, I keep getting warnings and errors like these (in Eclipse): Warning ... can't find referenced class ... Warning: there were ... unresolved references to classes or interfaces ... You may need to specify…
caw
  • 30,999
  • 61
  • 181
  • 291
53
votes
5 answers

Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease

I am trying to export apk and I want to enable Proguard but it throwing below error. I read so many answers and tried but didn't worked. Getting below error: Warning:Exception while processing task java.io.IOException: java.lang.NullPointerException…
Vivek Bansal
  • 2,471
  • 2
  • 19
  • 24