发现不支持的Gradle DSL方法: 'exclude()'

51
如果:
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
    }
}
我收到了这个错误信息:
Gradle 'mProject' project refresh failed: Build script error, unsupported Gradle DSL method found: 'exclude()'!
但这个可以工作:

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'
}

试图理解为什么,请澄清!

1个回答

164

使用

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

所以需要多加一些括号。


28
几个括号只需要几个小时...谢谢! - Eugene
2
我无法感谢您给我的这个提示! - KinGBin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接