Error:(27, 0) Gradle DSL method not found: 'compileSdkVersion()'

很多时候,我们想在我们工程的 build.gradle 文件中统一管理  依赖库的版本,所以,上面的问题就出现了。

完整的错误日志如下

Error:(27, 0) Gradle DSL method not found: 'compileSdkVersion()'
Possible causes:<ul><li>The project 'TouTiao-master' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
<a href="fixGradleElements">Upgrade plugin to version 2.3.2 and sync project</a></li><li>The project 'TouTiao-master' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>



  找了很久答案,都说把根目录下的  compileSdkVersion  这些删除,妹的,我就想要这样呢,删了还玩个蛋啊。


于是,找了别的工程(git 上下的一些别人的工程)

发现 少了个 = 号,加上就好了 如下图

1、在 工程的 build.gradle 中 如下图所示



2、在 app(module ) 中 如下图所示



3、再次 sync 发现错误解决

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值