java - 未找到 Gradle DSL 方法:'ooapply()'
问题描述
我在尝试解决链接 [StackOverflow Link] 之后的 google() 错误后收到此错误(错误:(6, 0) Gradle DSL method not found: 'google()')
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties 的代码
#Mon Jun 19 10:50:31 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
我的 Android Studio 版本是 3.3.2
以下是出现的完整错误。很少的帮助将非常有用。
Gradle DSL method not found: 'ooapply()'
Possible causes:
The project 'MyProject' 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.3.2 and sync project
The project 'MyProject' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
我无法继续...
解决方案
它看起来像另一个build.gradle文件中的问题。您附加的文件可能是项目级 build.gradle。
我猜问题出在模块级 build.gradle文件中。打开此文件并将ooapply替换为apply。
推荐阅读
- python - 为什么我添加背景时 TKinter 会打开 2 个窗口
- python - Python/Windows 不允许 numpy 分配 RAM “numpy.core._exceptions.MemoryError”
- django - 如何更改 django-oscar 仪表板上的货币符号?
- python - Python 类型的“状态变量”
- kdb - kdb 进程间通信并强制进程挂起
- python - 使用循环计算列表列表中每个第 n 个列表的平均值
- c# - 有没有办法只通过 FTP 获取某个日期范围内的文件?
- java - 调用 MultipleAccountPublicClientApplication() 时,MSAL 引发 MsalClientException
- python - AttributeError: 'list' 对象在尝试爬取 metro.co.kr 时没有属性 'find_element'
- python - 在python中使用pandas过滤计算值