updated from 5.3.1 to 5.4.0, then gradle build fails. 'Clean Project' returns the same exception.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':myapp'.
> Cannot change dependencies of configuration ':myapp:api' after it has been included in dependency resolution.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
My project gradle
buildscript {
ext.kotlin_version = '1.2.60-eap-27'
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-beta04'
classpath 'io.realm:realm-gradle-plugin:5.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'http://clojars.org/repo' }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
}
ext {
minSdk = 17
targetSdk = 28
compileSdk = 28
supportLib = '27.1.1'
fb = '4.34.0'
glide = '4.7.1'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Is it a multimodule project?
It's only one module.
Same issue here. One module, update from 5.3.1 to 5.4.0
Error:Cannot change dependencies of configuration ':app:api' after it has been included in dependency resolution.
I tried with a toy project using your Gradle configuration but couldn't reproduce the issue (I used Gradle 4.6 since you're using com.android.tools.build:gradle:3.2.0-beta04).
Can you send an example reproducing the issue?
It's all about
androidExtensions {
experimental = true
}
With experimental disabled everything works fine, when you enable it you'll see build error.
@Chesteer89 thx I was able to reproduce the issue, it looks related to the Realm Gradle Plugin changes introduced in https://github.com/realm/realm-java/pull/6025/files
As a workaround, you can apply Realm manually https://realm.io/docs/java/latest#how-do-i-customize-dependecies-defined-by-the-realm-gradle-plugin it should work.
@cmelchior can you have a look at this when you have time, I'm suspecting this https://github.com/realm/realm-java/pull/6025/files#diff-fbc37097ca151e18a6db623e59ebdba8R78 to be the root cause (it is executed on configuration phase & modify the dependencies, which is the closest thing related to the error message from Gradle)
@nhachicha thanks, it works now :+1:
It's happening for me on a multi module build.
@nhachicha I have androidExtensions {experimental = true} in the project module so applying Realm manually did the trick, thanks. 👍
@Jeff11 @eygraber A fix for this has been released in 5.5.0-SNAPSHOT https://github.com/realm/realm-java#using-snapshots Can you verify this fixes your builds?
5.5.0-SNAPSHOT is working 👍
A fix was released in 5.4.1
Most helpful comment
A fix was released in 5.4.1