微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android-找不到用于参数的方法getCompileConfiguration()[]

我收到以下错误.

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

解决方法:

我遇到了类似的问题,经过一段时间的互联网访问后,我发现了以下解决方案.
如果您在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'
                }
            }
        }

2)在应用程序级别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中

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐