使用Android Studio 3.0打开项目报错:Gradle 'XXX项目' project refresh failed

今天使用Android Studio 3.0打开一个老项目时,报使用的gradle版本不支持这个方法,出现如下错误:
Error:Unsupported method: BaseConfig.getApplicationIdSuffix().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.

Consult IDE log for more details (Help | Show Log)
如图:
在这里插入图片描述

解决方法:
第一步:
在这里插入图片描述在build.gradle文件中的jcenter()前加上google() //(提示:这一步可省略,报错提示蓝色链接时直接点击链接自动添加上了)
第二步:
在这里插入图片描述
修改所支持的版本,在此我用的版本是3.0.0,可以参考其他打开项目的版本来修改(检查其他build.gradle文件是否还有)
第三步:
在这里插入图片描述
修改gradle-wrapper.properties文件distributionUrl的链接(我也是参考其他打开项目修改的,省事儿)

以上是个人遇到此问题的解决方法,在此记录~~

猜你喜欢

转载自blog.csdn.net/ljl940811/article/details/83062429