Questions tagged [android-proguard]

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer.

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer. Because ProGuard makes your application harder to reverse engineer, it is important that you use it when your application utilizes features that are sensitive to security like when you are Licensing Your Applications.

ProGuard is integrated into the Android build system, so you do not have to invoke it manually. ProGuard runs only when you build your application in release mode, so you do not have to deal with obfuscated code when you build your application in debug mode. Having ProGuard run is completely optional, but highly recommended.

Official Documentation

1030 questions
86
votes
4 answers

ProGuard: duplicate definition of library class?

I run my ProGuard for my Android project and get the following warnings: Note: duplicate definition of library class [org.apache.http.conn.scheme.HostNameResolver] Note: duplicate definition of library class…
Michael
  • 32,527
  • 49
  • 210
  • 370
53
votes
8 answers

Proguard issue "Warning:Ignoring InnerClasses attribute for an anonymous inner class"

I don't know how I can describe this issue. I searched a lot, but I didn't find any solution. Also this solution did not help me -keepattributes EnclosingMethod: dependencies { compile project(':libraries:material-drawer') compile…
50
votes
3 answers

What is the difference between proguard-android.txt and proguard-rules.pro ? - Android

In my buildType I see this: buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } I have some questions: Why there are two files?…
MBH
  • 16,271
  • 19
  • 99
  • 149
50
votes
7 answers

Error:Execution failed for task ':android:transformClassesAndResourcesWithProguardForRelease'

Every time I am getting this error when running my project. I can do a Clean and then Run again, and it works. But it is not an optimal solution. Any ideas? Error:Execution failed for task…
Z0q
  • 1,689
  • 3
  • 28
  • 57
48
votes
5 answers

Proguard causing runtime exception with Android Navigation Component

I'm experiencing this crash when using proguard after integrating the NavigationComponent (android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha01) into my project with target and compile sdk of 27 2018-05-16 12:13:14.044…
46
votes
4 answers

build failing on play-services:11.8.x with pro guard parser error

So it looks like there is a bug in the latest play-services to be deployed. Does anyone know how to work around this issue? FAILURE: Build failed with an exception. * What went wrong: Execution failed for task…
Brill Pappin
  • 4,692
  • 1
  • 36
  • 36
45
votes
6 answers

Xamarin.Android Proguard - Unsupported class version number 52.0

I'm trying to use Proguard in my Xamarin.Android project, yet the compilation fails with the error Unsupported class version number [52.0] (maximum 51.0, Java 1.7) I saw from those two questions that it may be a mismatch between Java 7 and Java 8,…
Eino Gourdin
  • 4,169
  • 3
  • 39
  • 67
44
votes
1 answer

ConsumerProguardFiles vs ProguardFiles

I was trying to build an application which contained a library module La with proguard and I noticed that the library was not being obfuscated. Was trying to understand why. At this moment in time this was my buildType: release { minifyEnabled…
Peddro
  • 1,105
  • 2
  • 9
  • 19
40
votes
4 answers

Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints

When i want to generate a signed APK (release) using Proguard rules i got this error message : Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints: Dependency path…
Pensée Absurde
  • 1,315
  • 1
  • 14
  • 20
36
votes
2 answers

How to perform minification and obfuscation with the JACK compiler?

Google has released a test version of their new JACK compiler for Android developers with Android Studio 2.1. My question is, how do we enable obfuscation for the APK with JACK? The article below says that JACK performs obfuscation natively and…
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
29
votes
3 answers

How to upgrade ProGuard for Android?

I used Android SDK Manager to download the latest version of Android SDK. But ProGuard was not updated and remained at version 4.7. Is it necessary to manually download ProGuard from its website and unzip it to \android-sdk\tools\proguard ? Or will…
activity
  • 431
  • 1
  • 7
  • 9
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
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
25
votes
5 answers

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory

Similar questions have need asked already. But this one seems to be more complicated than previous ones because of changes in compatibility of Android Platforms. Here is my error log from Pixel and Pixel2 which are signed up for Android Beta…
1
2 3
68 69