Gradle DSL method not found: '1.3.11()'

GoogleGradle3.2 开始,全面限制了 Hidden API 的使用,甚至连 @DeprecatedAPI 也全部屏蔽了,本身 Google 的想法是好的。但对我这种做 系统级 APP 的人来说就不方便了,因此就把 Gradle 插件退回到 3.1.2 了,而且还用了 Kotlin

一开始用了 1~2 周,都没什么问题,结果今天 new Module 的时候就出这个错了:

Gradle DSL method not found: '1.3.11()'
Possible causes:<ul><li>The project 'SXFdroid' 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).
Upgrade plugin to version 3.2.1 and sync project</li><li>The project 'SXFdroid' may be using a version of Gradle that does not contain the method.
Gradle settings</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>

这个问题也不是第一次碰到,只是之前没怎么在意,然后忘了……然后又碰到了,结果还懵逼了一会儿。

看了好一会儿,发现是 kotlin 版本被自动加了一个新的:

buildscript {
    ext.kotlin_version = '1.3.11' '1.2.71'
    repositories {
        google()
        jcenter()
    }

问题就在这里,我一直用的 1.2.71 的版本,然后去掉 1.3.11 版本之后试了以下,果然就 OK 了。

猜你喜欢

转载自blog.csdn.net/weixin_33709590/article/details/86848589