intelliJ gradle and classpath for Proguard

Hi there,
testing with IntellilJ and Gradle, I’m following the setup example at Java/Kotlin Gradle

Adding the jcenter() to the repository brings no issue, but when I add classpath

A problem occurred evaluating project ‘:agent_api’.

Could not find method classpath() for arguments [com.guardsquare:proguard-gradle:7.0.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

‘com.guardsquare:proguard-gradle:7.0.1’ to my dependencies, i got an error: Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method classpath() for arguments [com.guardsquare:proguard-gradle:7.0.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
at org.gradle.internal.metaobject.AbstractDynamicObject$CustomMissingMethodExecutionFailed.(AbstractDynamicObject.java:190)
at org.gradle.internal.metaobject.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:184)
at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:86)

Of course this is where the documentation saying
" Please make sure the class path is set correctly for your system."

which of course i already set in my Ubuntu.

Any clue?

Hi Jordi,

I was able to reproduce your error. When you make a new project in IntelliJ, a build.gradle file will be created. I included the following in this build.gradle file resulting in the same error as you are
seeing:

repositories {
    maven {
        url 'https://maven.google.com'
    }
    jcenter()
}

dependencies {
    classpath 'com.guardsquare:proguard-gradle:7.0.1'
}

To obtain the desired result (successfully execute the Gradle Sync task), please replace the above with (make sure you add it above your plugins):

buildscript{
 repositories {
    maven {
        url 'https://maven.google.com'
    }
    jcenter()
}

 dependencies {
    classpath 'com.guardsquare:proguard-gradle:7.0.1'
 }
}

// plugins{

Please let me know if something would be unclear.

Kind regards,

Ewout