Gradle's java-plugin can't configure proguard


(Zhaoyun Liu) #1

I have a proguard task as follows:

‘’’ task myProguardTask(type: proguard.gradle.ProGuardTask) {

configuration(file: ‘scripts/tools/obfuscation.config’)

injars(file: ‘test.jar’)

libraryjars(file: ‘android.jar’)

outjars(file: ‘test_out.jar’) } ‘’’

but gradle always output errors on line " configuration(file: ‘scripts/tools/obfuscation.config’)"

‘scripts/tools/obfuscation.config’ is the path to my configuration file. As the http://proguard.sourceforge.net/index.html#manual/gradle.html docs says , ‘configuration’ is a closure setting.


(Benjamin Muschko) #2

I don’t think you are configuring the task correctly. Try this one:

task myProguardTask(type: proguard.gradle.ProGuardTask) {
     configuration file('scripts/tools/obfuscation.config')
    injars file('test.jar')
         libraryjars file('android.jar')
      outjars file('test_out.jar')
  }

(Zhaoyun Liu) #3

Thanks for quick reply. I had made two mistake in my gradle script.

  1. As you said, I passed the wrong params type to configuration 2. Only proguard version >= 4.9 has gradle task

Thax again.