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

来源:互联网 发布:数据库安全管理制度 编辑:程序博客网 时间:2024/05/15 10:57

很多时候,我们想在我们工程的 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 发现错误解决

阅读全文
0 0
原创粉丝点击