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"
}
}
删除最后一个类路径条目就解决了这个问题,但是AWS任务需要它。
奇怪的是,在我得到那个错误并再次运行gradle之后,我得到了一个完全不同的错误:“无法初始化类com.android.build.gradle.internal.ide.ModelBuilder”。这似乎没有得到任何谷歌的点击有任何帮助。
FWIW堆栈跟踪是:
Caused by: java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.toImmutableSet()Ljava/util/stream/Collector;
at com.android.build.gradle.internal.ide.DependenciesImpl.(DependenciesImpl.java:97)
at com.android.build.gradle.internal.ide.ModelBuilder.(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)
...