收到“错误:未找到 ID 为 'com.google.gms.google-services' 的插件”错误
Posted
技术标签:
【中文标题】收到“错误:未找到 ID 为 \'com.google.gms.google-services\' 的插件”错误【英文标题】:Getting "ERROR: Plugin with id 'com.google.gms.google-services' not found" error收到“错误:未找到 ID 为 'com.google.gms.google-services' 的插件”错误 【发布时间】:2020-12-08 20:56:56 【问题描述】:突然间我无法构建我的 android 应用程序。
以下是我的应用级 build.gradle
apply plugin: 'com.android.application'
android
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig
applicationId "com.udayrepo.classelearn"
minSdkVersion 16
targetSdkVersion 28
versionCode 20
versionName "0.5.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
packagingOptions
exclude 'META-INF/DEPENDENCIES'
android
lintOptions
warning 'DuplicatePlatformClasses'
dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.google.firebase:firebase-ads:15.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2',
exclude group: 'com.android.support', module: 'support-annotations'
)
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.google.apis:google-api-services-youtube:v3-rev206-1.25.0'
implementation 'junit:junit:4.12'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:cardview-v7:28.+'
implementation('com.foursquare:foursquare-android-oauth:1.0.3')
exclude group: 'com.google.android'
implementation 'com.android.volley:volley:1.1.1'
apply plugin: 'com.google.gms.google-services'
下面是我的项目级guild.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
repositories
google() // <--here
jcenter()
dependencies
classpath 'com.android.tools.build:gradle:3.2.1'
allprojects
repositories
google() // <-- here
jcenter()
当我同步时,我收到以下错误: 错误:未找到 ID 为“com.google.gms.google-services”的插件。
【问题讨论】:
您的目的是在您的应用程序中添加一个地理位置? 【参考方案1】:您必须将google-services
plugin 添加到您的build.gradle
文件中。
在您的***文件中添加:
buildscript
//....
dependencies
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.3.3'
【讨论】:
以上是关于收到“错误:未找到 ID 为 'com.google.gms.google-services' 的插件”错误的主要内容,如果未能解决你的问题,请参考以下文章