Gradle DSL method not found: 'exclude ()'

I work in Android Studio, and when I added the line to the build.gradle file

dependencies {
    compile files('libs/poi-ooxml-schemas-3.12-20150511-a.jar'){
        exclude group: 'stax', module: 'stax-api'
    }
}

I caught the error:

Gradle DSL method not found: 'exclude ()'

What is the cause of the error?

+1
source share
1 answer

As you defined the dependency, you applied the closure to filesinstead compile.

files('libs/poi-ooxml-schemas-3.12-20150511-a.jar'){
    exclude group: 'stax', module: 'stax-api'
}

Instead, you should be sure to apply the closure to compiledirectly.

compile(files('libs/poi-ooxml-schemas-3.12-20150511-a.jar')){
    exclude group: 'stax', module: 'stax-api'
}

But I doubt that this is necessary at all. Groups and modules are part of the Maven system, and the JAR file itself does not exclude this information.

+1
source

Source: https://habr.com/ru/post/1678391/


All Articles