【发布时间】:2021-12-10 12:39:27
【问题描述】:
我正在 Android Studio Bumblebee 中创建一个新应用程序,默认使用 settings.gradle 中的新 Groovy DSL 插件管理。
我需要能够使用 Google Play 服务来启用 Firebase 功能,但是在使用此处的文档应用 com.google.gms.google-play-services 插件时遇到了构建错误:Google Play Services Readme
我已将以下内容添加到我的 settings.gradle 文件中:
pluginManagement {
repositories {
gradlePluginPortal()
google()
}
plugins {
id 'com.android.application' version '7.1.0-alpha13'
id 'com.android.library' version '7.1.0-alpha13'
id 'org.jetbrains.kotlin.android' version '1.5.31'
id 'com.google.gms.google-services' version '4.3.10'
}
}
并将以下内容添加到我的应用程序的 build.gradle 文件中:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}
但是,当我构建应用程序时,我得到以下UnknownPluginException:
Plugin [id: 'com.google.gms.google-services', version: '4.3.10'] was not found in any of the following sources:
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.google.gms.google-services', version: '4.3.10'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.google.gms.google-services:com.google.gms.google-services.gradle.plugin:4.3.10')
Searched in the following repositories:
Gradle Central Plugin Repository
Google
我也尝试过classpath 等传统方法,但这会导致关于依赖关系解析的错误消息更长。
我不确定我做错了什么。
【问题讨论】:
标签: android android-studio gradle build.gradle