Unsupported Gradle DSL method found: 'exclude()'

AndroidGradle

Android Problem Overview


If:

dependencies {
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'de.keyboardsurfer.android.widget:crouton:1.8.3'
    compile 'de.greenrobot:eventbus:2.2.0'
    compile 'com.intellij:annotations:+@jar'
    compile 'com.jpardogo.googleprogressbar:library:1.0.0'

    compile project(':floatlabel')
    compile project(':Android-SwipeToDismiss')
    compile project(':Android-UndoBar') {
        exclude group: 'com.nineoldandroids', module: 'library' // without or without this one
    }
    compile project(':AndroidSlidingUpPanel:library') {
        exclude group: 'com.nineoldandroids', module: 'library' // without or without this one
    }
}

I receive this error message:

> Gradle 'mProject' project refresh failed: Build script error, unsupported Gradle DSL method found: 'exclude()'!

But this works:

dependencies {
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'de.keyboardsurfer.android.widget:crouton:1.8.3'
    compile 'de.greenrobot:eventbus:2.2.0'
    compile 'com.intellij:annotations:+@jar'
    compile 'com.jpardogo.googleprogressbar:library:1.0.0'

    compile project(':floatlabel')
    compile project(':Android-SwipeToDismiss')
    compile project(':Android-UndoBar')
    compile project(':AndroidSlidingUpPanel:library')
}

configurations {
    all*.exclude group: 'com.nineoldandroids', module: 'library'
}

Trying to understand why, please clarify!

Android Solutions


Solution 1 - Android

Use

compile (project(':Android-UndoBar')) {
        exclude group: 'com.nineoldandroids', module: 'library' // without or without this one
    }

So with extra parentheses.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEugeneView Question on Stackoverflow
Solution 1 - AndroidnhaarmanView Answer on Stackoverflow