使用gradle + ProGuard时出现NoSuchMethodError

时间:2014-11-03 10:19:42

标签: java gradle proguard

我正在尝试为Gradle创建ProGuard任务,但即使是java.lang.NoSuchMethodError: proguard.gradle.ProGuardTask.getLogging()Lorg/gradle/logging/LoggingManagerInternal的后卫示例任务失败,这是我的gradle.build

buildscript {
    repositories {
        flatDir dirs: 'proguard'
    }
    dependencies {
        classpath ':proguard:'
    }

}

subprojects{
    apply plugin: 'java'
    apply plugin: 'application'

    tasks.withType(Compile) {
        options.encoding = 'UTF-8'
}
sourceCompability = 1.7

dependencies{
    testCompile "junit:junit:4.11"
}

repositories{
    mavenCentral()
}


}

project(':csl'){
version = "0.1"

dependencies{
    runtime 'com.intellij:forms_rt:7.0.3'
    runtime group: 'com.jgoodies', name: 'jgoodies-common', version: '1.7.0'
    runtime group: 'com.jgoodies', name: 'jgoodies-forms', version: '1.7.2'
    runtime group: 'com.esotericsoftware', name: 'kryonet', version: '2.22.0-RC1'
    runtime group: 'com.esotericsoftware.kryo', name: 'kryo', version: '2.24.0'
    runtime group: 'org.apache.directory.studio', name: 'org.apache.commons.io', version: '2.4'

}


task obfuscate(type: proguard.gradle.ProGuardTask) {
    injars         'build/libs/csl.jar'
    outjars        'build/libs/csl-obf.jar'
//        libraryjars    "${System.getProperty('java.home')}/lib/rt.jar"
//        keep 'class org.gradle.** { *; }'
//        printmapping   'csl.map'
//        overloadaggressively
//        repackageclasses ''
//        allowaccessmodification
//
//        keep 'public class mypackage.csl.Main {  \
//    public static void main(java.lang.String[]);  \
//  }'
}

}

评论部分不影响结果。在./proguard中只有proguard.jar 或者也许Intellij IDEA与gradle和proguard集成?我找到的唯一信息是关于Android Studio

1 个答案:

答案 0 :(得分:0)

将ProGuard从4.1升级到5.1后,我遇到了同样的问题。 将gradle从1.9升级到2.2.1为我解决了这个问题。 最好的祝福 Christian Teister