Could not find method compile() for arguments [com.github.bumptech.glide:glide:3.7.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
时间: 2023-10-10 19:05:15 浏览: 49
这个错误可能是因为您正在使用的Gradle版本不支持`compile`方法。在Gradle 4.0及以上版本中,`compile`方法已被弃用,应该使用`implementation`或`api`方法。请尝试将您的依赖项更改为以下内容:
```
implementation 'com.github.bumptech.glide:glide:3.7.0'
```
如果您仍然遇到问题,请检查您的Gradle版本,并确保您的依赖项使用的是正确的方法。
相关问题
Could not find method compileSdk() for arguments [21] on object of type com.android.build.gradle.AppExtension
这个错误通常是因为您的 build.gradle 文件中的 Android 插件版本过低。您可以尝试将 Android 插件版本升级到最新版本,或者降低您的 compileSdk 版本。
例如,要将 Android 插件版本升级到最新版本,您可以将以下行添加到您的 build.gradle 文件中:
```
classpath 'com.android.tools.build:gradle:4.2.0'
```
请注意,版本号可能会有所不同,因此请根据您的情况进行更改。然后,在您的 app 模块的 build.gradle 文件中,将 compileSdkVersion 更改为您希望使用的版本,例如:
```
android {
compileSdkVersion 30
...
}
```
再次运行您的项目,看看是否解决了问题。
Could not find method compile() for arguments [org.xwalk:xwalk_core_library:23.53.589.4] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
这个问题可能是由于Gradle版本过低导致的,Crosswalk所需要的Gradle版本至少为2.1.0。解决方法如下:
1. 在项目根目录下的build.gradle文件中,将Gradle版本升级到2.1.0或以上:
```
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
```
2. 在应用模块的build.gradle文件中,将android插件版本升级到2.1.0或以上:
```
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
...
}
buildTypes {
...
}
}
dependencies {
compile 'org.xwalk:xwalk_core_library:23.53.589.4'
}
```
3. 在应用模块的build.gradle文件中,将Gradle的版本升级到2.1.0或以上:
```
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
```
升级Gradle版本可能会引发其他问题,需要根据具体情况进行调整。