问题:
在编译一个项目时(该项目在其它电脑上可以正常build),发生gradle错误提示,详细内容如下:
A problem occurred configuring project ':app'.
> Could not resolve all artifacts for configuration ':app:classpath'.
> Cannot resolve external dependency com.android.tools.build:gradle:3.6.0 because no repositories are defined.
Required by:
project :app
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
解决方式:
根据提示,很显然,gradle版本不正确,解决方式如下:
修改gradle版本,修改方式如下:
打开“Project Structure”,再输入下面的版本,就可以了。我用的是3.5.2的gradle。

附录:gradle版本和android plgin的对应关系:
Plugin version Required Gradle version
1.0.0 - 1.1.3 2.2.1 - 2.3
1.2.0 - 1.3.1 2.2.1 - 2.9
1.5.0 2.2.1 - 2.13
2.0.0 - 2.1.2 2.10 - 2.13
2.1.3 - 2.2.3 2.14.1 - 3.5
2.3.0+ 3.3+
3.0.0+ 4.1+
3.1.0+ 4.4+
3.2.0 - 3.2.1 4.6+
3.3.0 - 3.3.3 4.10.1+
3.4.0 - 3.4.3 5.1.1+
3.5.0 - 3.5.4 5.4.1+
3.6.0 - 3.6.4 5.6.4+
4.0.0+ 6.1.1+
4.1.0+ 6.5+
4.2.0+ 6.7.1+
熟悉编译工具的版本的影响,是程序员必修课之一。
6985





