I'm creating a new application in Android Studio Bumblebee and this defaults to using the new Groovy DSL plugin management in settings.gradle.
I need to be able to use Google Play Services to enable Firebase functionality, however I am running into a build error when applying the com.google.gms.google-play-services plugin using the documentation here: Google Play Services Readme
I have added the following to my settings.gradle file:
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'
}
}
and the following to my app's build.gradle file:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}
however when I build the application, I get the following 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
I have also tried the legacy method of classpath etc. but this results in a much longer error message regarding dependency resolution.
I'm not sure what I am doing wrong.
By using Android Studio Bumblebee new Groovy DSL plugin management Add below line in build.gradle(Project:) plugins{} section and sync project will solve your problem.
id 'com.google.gms.google-services' version '4.3.10' apply false
your build.gradle(Project:) looks like
plugins {
id 'com.android.application' version '7.1.1' apply false
id 'com.android.library' version '7.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'com.google.dagger.hilt.android' version '2.41' apply false
id 'com.google.gms.google-services' version '4.3.10' apply false
id 'com.google.firebase.crashlytics' version '2.8.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
your build.gradle(Module:) looks like
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.kapt'
id 'com.google.dagger.hilt.android'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
android {
compileSdk 32
signingConfigs {
config {
enableV3Signing true
enableV4Signing true
}
}
}
your settings.gradle(Project Settings) looks like
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "MyApp"
include ':app'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With