I could not able to build my library module on Android studio. I got the following exception in build.gradle file:
Cannot change dependencies of configuration ':smack-android:compile' after it has been included in dependency resolution.
* Where:
Build file '/Users/...../build.gradle' line: 15
I am using Android studio 3.2.1 and Gradle version is 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 }
Any help on this?