无法为参数[]找到方法getCompileConfiguration() [英] Could not find method getCompileConfiguration() for arguments[]
问题描述
我收到以下错误消息。
I'm getting the following error.
无法在
类型$ b的对象上找到参数[]的getCompileConfiguration()方法$ b 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)在App level 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屋!