找不到参数 [] 的方法 getCompileConfiguration() [英] Could not find method getCompileConfiguration() for arguments[]

查看:34
本文介绍了找不到参数 [] 的方法 getCompileConfiguration()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误.

I'm getting the following error.

无法为参数 [] 找到方法 getCompileConfiguration()类型对象com.android.build.gradle.internal.api.ApplicationVariantImpl.

Could not find method getCompileConfiguration() for arguments [] on object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.

推荐答案

我遇到了类似的问题,在互联网上花了一些时间后,我找到了以下解决方案.如果您在 build.gradle 中使用最新版本的 google-services,则需要进行以下更改:-

I was facing similar issue and after spent some time over internet I found below solution. If you are using latest version of google-services in build.gradle then following changes need to be done :-

1) 在项目级 build.gradle

1) In project level 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'
                }
            }
        }

2) 在应用级 build.gradle

2) In App level build.gradle

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 中

3) In gradle-wrapper.properties

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

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

这篇关于找不到参数 [] 的方法 getCompileConfiguration()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆