I am getting this error while adding proguard in my project.
> "Could not get unknown property ‘ProguardTask’ for root project ‘android-agent’ of type org.gradle.api.Project."
I have mentioned my code below:
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: uberjar) {
injars uberjar.archivePath
outjars uberjar.archivePath.toString().replace(uberjar.classifier, ‘standalone’)
libraryjars javaRtLib()
libraryjars jsseLib()
configuration file("$rootDir/proguard.pro")
}
task proguardTest(type: Test, dependsOn: proguard) {
testLogging { exceptionFormat “full” }
classpath = classpath - files(sourceSets.main.output.classesDir) - files(configurations.runtime) +
files(proguard.outputs.files.singleFile)
}
task proguardCheck << {
File f1 = file(uberjar.archivePath);
File f2 = file(proguard.outputs.files.singleFile);
DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(2);
df.setMinimumFractionDigits(2);
println('Compress: ’ + df.format(f2.length() * 100.00 / f1.length()) + “%”);
}
proguardCheck.dependsOn proguardTest
uploadArchives.dependsOn proguardCheck