找不到支持的Gradle DSL方法:'exclude()'

Eug*_*ene 47 android gradle

如果:

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
    }
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息:

Gradle 'mProject' project refresh failed: Build script error, unsupported Gradle DSL method found: 'exclude()'!
Run Code Online (Sandbox Code Playgroud)

但这有效:

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'
}
Run Code Online (Sandbox Code Playgroud)

试着理解原因,请澄清!

nha*_*man 152

使用

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

额外的括号.

  • 几个小时的几个parantheses ...谢谢! (27认同)
  • 非常乐于助人 - 希望我能为您提供更多积分! (2认同)
  • 我对你的提示感激不尽! (2认同)