我无法在Android Studio上构建库模块。我在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 Studio 3.2.1,而Gradle版本是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 }
对此有任何帮助吗?