I've seen this mentioned a couple of times but yet to find a solution - after upgrading Gradle to 4.10.2 and the Android gradle plugin to 3.2.1, I'm having a lot of difficulties trying to build an Android app. It appears to be an incompatibility between plugins, specifically to do with the version of Guava in use. I believe it's one of the AWS plugins I'm using that's causing the issue but I'm using the latest version and I can't find any straightforward way of separating out the gradle script that needs the AWS plugin and the one that needs the Android plugin. Is there some way I can tell gradle which version of Guava to use when loading the AWS plugin? I've tried this but to no avail:
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "com.google.guava:guava:27.0.1-android"
classpath "jp.classmethod.aws:gradle-aws-plugin:0.38"
}
}
Just removing that last classpath entry fixes the problem, but I need it for the AWS tasks.
The strange thing is after I get that error and run gradle again I get a completely different error: "Could not initialize class com.android.build.gradle.internal.ide.ModelBuilder". This doesn't seem to get any google hits at all that are helpful.
FWIW the stack trace is:
Caused by: java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.toImmutableSet()Ljava/util/stream/Collector;
at com.android.build.gradle.internal.ide.DependenciesImpl.<init>(DependenciesImpl.java:97)
at com.android.build.gradle.internal.ide.ModelBuilder.<clinit>(ModelBuilder.java:134)
at com.android.build.gradle.BasePlugin.registerModels(BasePlugin.java:612)
at com.android.build.gradle.BasePlugin.configureExtension(BasePlugin.java:576)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.apply(BasePlugin.java:290)
at com.android.build.gradle.AbstractAppPlugin.apply(AbstractAppPlugin.java:122)
at com.android.build.gradle.AppPlugin.apply(AppPlugin.java:43)
at com.android.build.gradle.AppPlugin.apply(AppPlugin.java:35)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42)
...