添加apply插件后:'com.google.gms.google-services
'。我收到以下错误
An error occurs after sync.ERROR: No such property: applicationVariants for class: java.lang.String
打开文件。
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
repositories {
maven { url 'https://jitpack.io' }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation("com.mikepenz:materialdrawer:6.0.8@aar") {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
最佳答案
尝试添加classpath 'com.google.gms:google-services:4.3.3'
并删除带有“apply plugin”的行。
它应该工作。
关于android - 错误构建gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58656753/