Could not find method compile() for arguments Gradle
Make sure that you are editing the correct build.gradle
file. I received this error when editing android/build.gradle
rather than android/app/build.gradle
.
It should be exclude module: 'net.milkbowl:vault:1.2.27'
(add module:
) as explained in documentation for DependencyHandler
linked from here because ModuleDependency.exclude(java.util.Map)
method is used.
compile
is a configuration
that is usually introduced by a plugin (most likely the java plugin) Have a look at the gradle userguide for details about configurations. For now adding the java plugin on top of your build script should do the trick:
apply plugin:'java'
Note that the compile
, runtime
, testCompile
, and testRuntime
configurations introduced by the Java plugin have been deprecated since Gradle 4.10 (Aug 27, 2018), and were finally removed in Gradle 7.0 (Apr 9, 2021).
The aforementioned configurations should be replaced by implementation
, runtimeOnly
, testImplementation
, and testRuntimeOnly
, respectively.