它已被列入依赖解析后:机器人无法更改配置的依赖关系“编译”(Android Cannot chang

2019-10-30 13:04发布

我能不能建造我的库模块在Android工作室。 我在的build.gradle文件中的以下异常:

Cannot change dependencies of configuration ':smack-android:compile' after it has been included in dependency resolution.

* Where:
Build file '/Users/...../build.gradle' line: 15

我使用的是Android 3.2.1工作室和摇篮的版本是4.6

的build.gradle:

dependencies {
    // androidProjects lists all projects that are checked to compile against android.jar
    // Filter out the optional Smack dependencies from androidProjects
    androidProjects.findAll {
        ![':some-module'].contains(it.getPath())
    }.each { project ->
        compile project // Line no 15 exception occurred
    }
}

compileJava {
    options.bootClasspath = androidBootClasspath
}

// See http://stackoverflow.com/a/2823592/194894
// TODO this doesn't seem to work right now. But on the other hand it
// is not really required, just to avoid a javadoc compiler warning
javadoc {
    options.linksOffline "http://developer.android.com/reference", androidJavadocOffline
}

configure (androidProjects) {
    task compileAndroid(type: JavaCompile) {
        source = compileJava.source
        classpath = compileJava.classpath
        destinationDir = new File(buildDir, 'android')
        options.bootClasspath = androidBootClasspath
    }
}

test { dependsOn androidProjects*.compileAndroid }

任何帮助?

文章来源: Android Cannot change dependencies of configuration ':compile' after it has been included in dependency resolution