簡體   English   中英

找不到 Gradle DSL 方法:'ooapply()'

[英]Gradle DSL method not found: 'ooapply()'

在嘗試解決鏈接 [StackOverflow Link] 之后的 google() 錯誤后,我收到此錯誤( 錯誤:(6, 0) Gradle DSL 方法未找到:'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

我的安卓工作室版本是 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM