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

proguard Missing type parameter

i try obfuscate my code of android app with ProGuard. But after this my app give exception at running: 11-15 01:46:26.818: W/System.err(21810): java.lang.RuntimeException: Missing type parameter. 11-15 01:46:26.828: W/System.err(21810): at…
Mrusful
  • 1,503
  • 1
  • 18
  • 32
35
votes
3 answers

How can I obfuscate my sdk coded with kotlin (and get rid of Metadata)

I'm developing a SDK (Android library), and I have to obfuscate a large part of my code so the customer may not try and play with internal code. My lib is coded in kotlin, and I used proguard to obfuscate the code. Problem is that there are still…
AlexG
  • 367
  • 3
  • 6
35
votes
7 answers

Using GSON with proguard enabled

My code works perfectly without proguard, but GSON doesn't work when proguard is enabled. This is the part of code where it doesn't works JSONArray mensaje = response.getJSONArray("categorias"); // Parsear con Gson Categorias[] categorias =…
35
votes
11 answers

ClassNotFoundException: Didn't find class on path: DexPathList

I have a problem since I updated my App on playstore. Since this update, the exception is thrown, but I haven´t changed anything related to this exception. Stacktrace: java.lang.RuntimeException: Unable to instantiate activity…
Opiatefuchs
  • 9,800
  • 2
  • 36
  • 49
35
votes
3 answers

Is proguard.cfg needed for library projects?

Assuming I need to apply the same rules for both an application project and a library project on which it relies, do I need to duplicate the content of proguard.cfg from the application to the library project? In other words, does the application's…
Regex Rookie
  • 10,432
  • 15
  • 54
  • 88
34
votes
8 answers

ProGuard and Gson on Android (ClassCastException)

I am having a hell of a time with Gson and ProGuard. I have a simple object and when I parse tojson, save to sqllite and read back from the database in order to load the json back to my object, I get a java.lang.classcastexception. If I dont use…
Jesse
  • 2,674
  • 6
  • 30
  • 47
34
votes
4 answers

Minify android app but do not obfuscate it

When I do not minify my app I reach the maximum method count and building the dex file fails. This can be avoided by enabling minify in build.gradle. The downside, however, is that now the code gets obfuscated. This is OK for the Release build but…
user4918296
34
votes
2 answers

Setting up ProGuard with Android Library Projects

I'm trying to setup proguard for my Android project. My application project has very little code in it, but references a library project which has the vast majority of the code and any other external jars. That being said, I'm not sure how to setup…
user1132897
  • 1,201
  • 1
  • 15
  • 27
34
votes
1 answer

Proguard returned with error code 1. See console

I am receiving this exception while creation of signed apk of my application. I have 5 library projects added to my project as well. Any hint how to resolve this issue? Here is my config file: -optimizationpasses…
Aqif Hamid
  • 3,511
  • 4
  • 25
  • 38
33
votes
4 answers

Gradle : DSL element 'useProguard' is obsolete and will be removed soon

Since the 3.5 update of Android Studio, I have this warning when building my app : DSL element 'useProguard' is obsolete and will be removed soon. Use 'android.enableR8' in gradle.properties to switch between R8 and Proguard..
Greelings
  • 4,964
  • 7
  • 34
  • 70
33
votes
4 answers

Proguard ignores config file of library

I'm facing a really weird problem for days now... I have a Gradle app with two modules, one main module and one library module. In both modules I have declared a proguard-rules.pro file path which is correct In both .gradle files I have…
Marian Klühspies
  • 15,824
  • 16
  • 93
  • 136
33
votes
7 answers

proguard-project.txt not found in android studio

I am new to Android and Android Studio. During my learning I came across the Google Play Services for Ads and all. I tried to enable proguard in my project but reading the below link proguard. The problem is that I am not able to find…
MCA Shah
  • 405
  • 1
  • 4
  • 10
33
votes
1 answer

Prevent Proguard from removing empty constructor of fragment

You know, all subclasses of Fragment must include a public empty constructor but when using proguard these constructors will be removed. I have specified below commands but empty constructor still be removed. Can anyone help me to keep empty…
Wayne
  • 6,361
  • 10
  • 46
  • 69
32
votes
1 answer

Android/java: Transition / Migration from ProGuard to R8?

I wonder how to make the transition / migration from ProGuard to R8. Should I just remove the Proguard-related lines from my Gradle files and add the android.enableR8 = true line instead ? Thanks.
toto_tata
  • 14,526
  • 27
  • 108
  • 198
32
votes
2 answers

Obfuscate entire React Native app including JavaScript code

How to obfuscate my react-native JS code? I have set the following in my build.gradle file: release { minifyEnabled true proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } Here is my proguard-rules.pro…
artsnr
  • 952
  • 1
  • 10
  • 27