gradle build时报错:Could not find method compile() for arguments [{group=io.github.java-diff-utils, name=java-diff-utils, version=4.12}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
时间: 2024-02-20 18:00:40 浏览: 34
这个错误通常是因为在你的build.gradle中使用了过时的依赖配置方式。在较新版本的Gradle中,`compile`已经被弃用,建议使用`implementation`或`api`代替。
你可以尝试将`compile`改成`implementation`或`api`,例如:
```
implementation 'io.github.java-diff-utils:java-diff-utils:4.12'
```
如果你的Gradle版本较老,不支持`implementation`或`api`,你可以考虑将Gradle版本升级到4.6及以上。
相关问题
implementation 手动在build.gradle中添加java-diff-utils
好的,你的第一个问题是关于在build.gradle中手动添加Java Diff Utils的实现。为了添加Java Diff Utils,你需要在build.gradle文件中的dependencies部分添加以下代码:
```implementation 'com.github.java-diff-utils:java-diff-utils:4.11'```
这将使Gradle下载并添加Java Diff Utils库到你的项目中。记得在添加依赖后同步Gradle文件。
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.
这个错误可能是因为您正在使用的Gradle版本不支持`compile`方法。在Gradle 4.0及以上版本中,`compile`方法已被弃用,应该使用`implementation`或`api`方法。请尝试将您的依赖项更改为以下内容:
```
implementation 'com.github.bumptech.glide:glide:3.7.0'
```
如果您仍然遇到问题,请检查您的Gradle版本,并确保您的依赖项使用的是正确的方法。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)