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

Keep inner interface method names in proguard

Lets say I have.. public class SomeClass { public interface someInterface { public void firstMethod(String variable); public void secondMethod(String variable); public void thirdMethod(); } } and I…
Vic Vuci
  • 6,993
  • 6
  • 55
  • 90
29
votes
5 answers

ProGuard says Unsupported class version number [52.0] (maximum 51.0, Java 1.7) with sbt-proguard

I'm on Mac OS X 10.9.2 and sbt 0.13.3-SNAPSHOT (built from the sources), Java 8 and sbt-proguard 0.2.2 plugin. sbt 0.13.3-SNAPSHOT [jacek]> sbtVersion [info] 0.13.3-SNAPSHOT Java 8 $…
Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
29
votes
3 answers

Android Proguard configuration for the v7 Support Library ActionBar

I'm using the v7 Support Library to show an ActionBar on Android 2.x. It works well enough but I had to fix a few class/method not found errors after enabling Proguard. Are there any guidelines on which classes need to be preserved? So far I have…
Mirko N.
  • 10,537
  • 6
  • 38
  • 37
29
votes
3 answers

How to configure proguard for javascript interface?

I have a implemented a Webview which takes use of JavascriptInterface. It's working fine when not obfuscating, but at once Proguard is active, it does not work. I've looked here at other answers, but i still can't get it working. Some of the WebView…
Ikky
  • 2,826
  • 14
  • 47
  • 68
29
votes
3 answers

Android ProGuard settings for Facebook

I finally found out why my app crashes built for release. ProGuard was indeed stripping code from my application but i prevented this by manually adding the classes with the keep command in the proguard-android.txt (found in the sdk). For Facebook I…
Mark Molina
  • 5,057
  • 8
  • 41
  • 69
28
votes
8 answers

Retrofit body request is blank with Retrofit, when I use proguard and enable minify and shrinkresources

When I set minifyEnabled & shrinkResources to true,the Retrofit body JSON request sent is blank, and when it is set to false then it works perfectly fine. I have posted the whole gradle file so that, you can help me telling what I am doing wrong. My…
Salman Shaikh
  • 589
  • 6
  • 19
28
votes
5 answers

Proguard Printmapping not working in Android Studio 2.0.0 (and 2.1.0)

Using gradle wrapper 2.10, and Android Gradle build tools 2.0.0-beta7 2.1.0 From my build.gradle: buildTypes { all{ minifyEnabled true proguardFiles = [getDefaultProguardFile("proguard-android.txt"),…
Vic Vuci
  • 6,993
  • 6
  • 55
  • 90
28
votes
7 answers

Android Studio & ProGuard: cannot resolve symbol getDefaultProguardFile?

IDE: Android Studio 1.1.0 Subject: ProGuard Problem: ProGuard files or tools not recognized by Android Studio, getDefaultProguardFile can not be resolved and there's no proguard-android.txt and proguard-rules.txt files in the app, see the image…
Fadi Obaji
  • 1,454
  • 4
  • 27
  • 57
28
votes
13 answers

How to change the proguard mapping file name in gradle for Android project

I have android project based on gradle and I want to change mapping.txt file name after it's generated for my build. How can it be done? upd How it can be done in build.gradle? Since I have access there to my flavors and other stiff, I would like to…
olegflo
  • 1,105
  • 3
  • 17
  • 26
27
votes
3 answers

Android ant build: proguard can't find referenced method in class ViewConfigurationCompatFroyo

I'm very short on time here, so I truly hope someone here has a clue how to fix these: [proguard] Warning: android.support.v4.view.ViewConfigurationCompatFroyo: can't find referenced method 'int getScaledPagingTouchSlop()' in class…
Ophidian
  • 584
  • 8
  • 16
27
votes
3 answers

How to deobfuscate an Android stacktrace using mapping file

I got a stacktrace from the crashreporting system and it is obfuscated, like ... Failed resolution of: Lru/test/c/b/a; ... I have a mapping file. How to deobfuscate this stacktrace using mapping.txt?
Maksim Turaev
  • 4,115
  • 1
  • 29
  • 42
27
votes
2 answers

How to resolve multiple D8 warnings: was not found, it is required for default or static interface methods desugaring ?

After upgrading to Android Gradle Plugin from 3.1.4 to 3.2.x I'm getting multiple warnings such as: D8: Type `com.google.gson.reflect.TypeToken` was not found, it is required for default or static interface methods desugaring of…
27
votes
9 answers

Retrofit 2 not sending data when ProGuard is enabled

I try to login my users using Retrofit 2. (Basically a GET to the login URL with a basic header) It works well but once I ProGuard it, the Header Authorization is not sent anymore. (See log outputs) Sample code : User Model : public interface…
Romain
  • 1,390
  • 1
  • 13
  • 27
27
votes
1 answer

Android Build with Gradle and ProGuard : "The output jar must be specified after an input jar, or it will be empty"

I'm creating a build with different flavors with Gradle. It used to run quite good until now, until I wanted to enable Proguard. I enabled minifyEnabled for my Release Build and now I'm having an exception saying : "Caused by:…
osayilgan
  • 5,873
  • 7
  • 47
  • 68
27
votes
5 answers

Running ProGuard on OS X: Where is Apple's equivalent to the rt.jar?

I'm running ProGuard to shrink my jar file. One of the parameters it needs is the system's runtime jar. This is at $JAVA_HOME/lib/rt.jar on Sun distributions, but not on Apple's Mac OS X (v10.6 (Snow Leopard) in my case). Is there an rt.jar for…
dacracot
  • 22,002
  • 26
  • 104
  • 152