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

标签 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
    }
}

我收到此错误消息:

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

试图了解原因,请澄清!

最佳答案

使用

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

所以加上额外的括号。

关于android - 发现不支持的 Gradle DSL 方法 : 'exclude()' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23172458/

相关文章:

java - Android butterknife

java - 如何使用 Android 中的加速度计值计算特定轴的旋转速率

Java 接口(interface)作为方法的参数

android - 使用 SMS 作为网站的身份验证因素

java - 尝试运行 Sagan spring.io 项目 java.lang.IllegalAccessError 时出错

android-studio - Gradle-无法获取配置容器的未知属性 'scm'

android - 对 Android 文档 : Fragments 的澄清

android - 什么是主题,我如何知道我是否拥有 "correct"主题?

eclipse - Gradle:主机名不能包含空格

eclipse - 找不到LibGDX + Gradle + Maven对Tween Engine的引用