我收到以下错误.
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