Gradle DSL method not found:

Gradle DSL method not found: 'xxx()' 

Gradle DSL method not found: 'compileOnly()'  or Gradle DSL method not found: 'implementation()' 

今天我们来唠唠gradle编译时报的这类错,很多新手朋友会不明白。

这其实就是说,当前的gradle版本,没有“xxx()”方法,而你项目中直接用了这个method,或者间接用了(比如我们rn项目引用的第三方包里面,用了这个method)

像上图中,这个错,就是说在4.0中,

react-native-linear-gradient\android\build.gradle' line: 21的这个gradle方法在当前gradle版本中不可用

知道了原因,那解决方法就很容易啦。

第一,升级gradle版本

第二,把对应的方法更改成当前gradle中的方法。比如,'compileOnly()'和'implementation()' 都可以换成"

compile()"

你可能感兴趣的:(Gradle DSL method not found:)