Android 找不到参数[]的方法getCompileConfiguration()

Android 找不到参数[]的方法getCompileConfiguration(),android,cordova,android-studio,ionic-framework,Android,Cordova,Android Studio,Ionic Framework,我得到以下错误。 在上找不到参数[]的方法getCompileConfiguration() 类型的对象 com.android.build.gradle.internal.api.ApplicationVariatimpl 我们也有同样的问题。。。通过升级gradle-wrapper.properties中的gradle解决 distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip 以及gra

我得到以下错误。

在上找不到参数[]的方法getCompileConfiguration() 类型的对象 com.android.build.gradle.internal.api.ApplicationVariatimpl


我们也有同样的问题。。。通过升级gradle-wrapper.properties中的gradle解决

distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
以及gradle.build中的gradle插件

repositories {
    google()
    ...
}

dependencies {
    ...
    classpath 'com.android.tools.build:gradle:3.1.0'
}

我也面临着类似的问题,在上网一段时间后,我找到了下面的解决方案。 如果您正在build.gradle中使用最新版本的google services,则需要进行以下更改:-

1) 在项目级build.gradle中

        buildscript {
            repositories {
                jcenter()
                mavenLocal()
                maven {
                    url 'https://maven.google.com/'
                    name 'Google'
                }
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:3.1.2'
                classpath 'com.google.gms:google-services:3.3.1'
            }
        }

        allprojects {
            repositories {
                jcenter()
                mavenLocal()
                maven {
                    url 'https://maven.google.com/'
                    name 'Google'
                }
            }
        }
android{
    //All other
    buildToolsVersion '27.0.3'
    }
        dependencies {
        // All other
            implementation 'com.google.firebase:firebase-database:15.0.1'
        }
        apply plugin: 'com.google.gms.google-services'
2) 应用程序内级别build.gradle

        buildscript {
            repositories {
                jcenter()
                mavenLocal()
                maven {
                    url 'https://maven.google.com/'
                    name 'Google'
                }
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:3.1.2'
                classpath 'com.google.gms:google-services:3.3.1'
            }
        }

        allprojects {
            repositories {
                jcenter()
                mavenLocal()
                maven {
                    url 'https://maven.google.com/'
                    name 'Google'
                }
            }
        }
android{
    //All other
    buildToolsVersion '27.0.3'
    }
        dependencies {
        // All other
            implementation 'com.google.firebase:firebase-database:15.0.1'
        }
        apply plugin: 'com.google.gms.google-services'
3) 在gradle-wrapper.properties中

distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip

分配=https://services.gradle.org/distributions/gradle-4.4-all.zip

显示您的代码。我是混合(IONIC 1)应用程序开发人员。我安装了fcm、谷歌分析和位置插件。我添加了maven{url”“//谷歌的maven repository}插件依赖项的build.gradle中。我做了相同的更改,但显示以下错误:-错误:项目:声明从配置“debugCompile”到配置“debug”的依赖项,该依赖项未在项目的描述符中声明:CordovaLib。我做了所有更改,但得到错误:-项目:声明来自配置的依赖项“debugCompile”到配置“debug”,该配置未在项目的描述符中声明:CordovaLib