android - 如何在 Build.gradle (app) 中添加这个插件
问题描述
应用插件:'com.google.gms.google-services' <-我应该在哪里添加这个?
所以我最近安装了一个新版本的 android studio 并且有一个新格式的 Gradel 插件那么我可以在哪里将应用插件放在下面的代码中?
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.social.login2"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}```
解决方案
更改以下几行
plugins {
id 'com.android.application'
}
至
plugins {
id 'com.android.application'
id ''com.google.gms.google-services'
}
而不是应用插件,现在使用的方式是在插件块内给出 id 名称,然后在引号内给出 id。
推荐阅读
- php - 如何在表单提交中按角色过滤 WP_User_Query()
- apache-kafka - Kafka - 处理速度慢的消费者的最佳实践。如何实现更多的并行性?
- python - 完成 firefox selenium 测试后出现“没有这样的文件或目录”错误消息
- javascript - 带有背景图像的响应式倾斜 Div
- python - Pyradiomics:要素类 glcm 无法识别。如何解决?
- excel - 跨多个列的大型数据集的 INDEX MATCH
- amazon-web-services - 将数据从 AWS DocumentDB 账户迁移到另一个 Document DB 账户?
- angular - Angular,rxjs:使用 flatMap 修复嵌套订阅
- python - 使用 python 或 awk 查找具有特定后缀的所有核心元素
- python - 如何在 Jupyter 笔记本中使用来自外部 Python 文件的代码?