1

I have a Gradle app with 1 library aar project and few flavours, I am trying to implement proguard for library project.

I have declared proguard-rules.pro file as well as proguard-library.pro file. I have minifyenabled true, useproguard true but Proguard does not seem to work. I am using Android studio 2.1.2 with a gradle wrapper 2.10.

I also followed steps from the link below but did not work, Proguard ignores config file of library

Can someone help to get proguard to run for my library aar project.

Edited: I am just testing if proguard works for debug or not, My gradle file is as below:

Edited debug code below:

defaultConfig {
     proguardFiles 'proguard-library.pro'
     consumerProguardFiles 'proguard-rules.pro'
     ...
     ...
}

buildTypes{


debug {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        ....
        ...
        }

}
Community
  • 1
  • 1
Swato
  • 11
  • 4

1 Answers1

0

I guess you must receive some error messages, as your build.gradle contains a few errors. Specifically, you will need to remove the following lines:

apply plugin: 'maven'
useProguard true

Unless it is just a copy&paste error, you normally specify the proguardFiles like this:

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
T. Neidhart
  • 6,060
  • 2
  • 15
  • 38
  • I removed those 2 lines, but proguard does not work, the below line is a copy paste error, proguard files were mentioned as indicated by you – Swato Jul 07 '16 at 18:24
  • I had some build errors, so took the android studio suggestions and added apply plugin: 'maven', I checed on someother answer on stackoverflow which says minifyEnable does not obfuscate code. Please see link: http://stackoverflow.com/questions/37007485/whats-the-difference-between-minifyenabled-and-useproguard-in-the-android-p – Swato Jul 07 '16 at 21:58