Could not find method classpath() for arguments com.google.gms:google-services
Could not find method classpath() for arguments [com.google.gms:google-services:4.6.0]Short answer
Gradle only knows classpath() inside buildscript { dependencies { } }. If the line sits in a normal dependencies block, such as the app module's, Gradle cannot find the method. Move it into buildscript, or switch to the plugins block with apply false and delete the classpath line.
Fix it fast
1Find out which cause you have
Find every classpath line and see which block it is in. It must be inside buildscript, not in a plain dependencies block.
grep -rn "classpath\|buildscript" --include=build.gradle --include=build.gradle.kts .2Match what you see, then jump to its fix
- 1
The failing line is in app/build.gradle or in a dependencies block outside buildscriptclasspath is in a normal dependencies blockFix - 2
The root build file starts with plugins { ... } and you pasted a classpath line from an older guideThe project already uses the plugins blockFix - 3
A copied snippet shows only dependencies { classpath ... } with no buildscript above itclasspath is used in a file that has no buildscript block at allFix
- 1
What does the error look like?
Could not find method classpath() for arguments [com.google.gms:google-services:4.6.0]Sync fails right after adding the Google Services classpath line from a Firebase setup guide
Cause 1 of 3
classpath is in a normal dependencies block
1Check
Gradle documents classpath only inside buildscript { dependencies { } }. A normal dependencies block is not that place.
sed -n 1,40p build.gradle2Fix
Put the line inside the buildscript block of the project-level build.gradle, and apply the plugin in the app module.
// project-level build.gradle
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.6.0'
}
}
// app/build.gradle
apply plugin: 'com.google.gms.google-services'3Verify
Sync, then build the module.
./gradlew :app:assembleDebugConfirmed by firebase.google.com
Cause 2 of 3
The project already uses the plugins block
1Check
The Firebase setup page now declares the plugin in the root plugins block with its version and apply false, and applies it by id in the module. That setup needs no classpath line.
grep -n "google-services" build.gradle* app/build.gradle*2Fix
Remove the classpath line, then declare and apply the plugin by id.
// root build.gradle, inside plugins { }
id 'com.google.gms.google-services' version '4.6.0' apply false
// app/build.gradle, inside plugins { }
id 'com.google.gms.google-services'3Verify
Sync again; the method error should be gone.
./gradlew :app:assembleDebugConfirmed by firebase.google.com
Cause 3 of 3
classpath is used in a file that has no buildscript block at all
1Check
In the Gradle manual, classpath appears together with a repositories declaration for the script itself, inside buildscript. A bare dependencies block does not provide it.
grep -n -B3 "classpath" build.gradle*2Fix
Wrap the dependency in buildscript with its own repositories, or move to the plugins block as in the second cause.
buildscript {
repositories { google(); mavenCentral() }
dependencies { classpath 'com.google.gms:google-services:4.6.0' }
}3Verify
Run a sync from the command line.
./gradlew helpConfirmed by docs.gradle.org
How do I stop it coming back?
- Copy plugin setup from the vendor's current page, and pick one style (plugins block or buildscript) for the whole project.
- Keep plugin declarations in the project-level file and only apply them in modules.
- Check the Firebase setup page for the current plugin version when you upgrade.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
Related fixes
Mobile apps
Gradle cannot find com.google.firebase:firebase-analytics-ktx
Required by: project :app
Firebase moved the Kotlin extensions into the main modules and stopped releasing the -ktx modules in July 2025.
2 causes, each with a fixMobile apps
FirebaseInstanceIdService and FirebaseInstanceId.getToken() no longer work
Deprecation warning on FirebaseInstanceId.getInstance().getToken()
Move token handling into a class that extends FirebaseMessagingService and override onNewToken, which runs when a token is first created and whenever it changes.
2 causes, each with a fixMobile apps
The Google Services plugin cannot find google-services.json in an Android app
File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.
The Google Services plugin looks for google-services.json in the app module folder, or in a build-type folder under src.
3 causes, each with a fixMobile apps
Expo Android push fails because google-services.json is missing
"google-services.json" is missing for firebase
Android push in Expo goes through Firebase Cloud Messaging, which needs two separate things: the google-services.json file inside the app, pointed to by android.googleServicesFile, and a service account key uploaded to Expo for sending.
2 causes, each with a fixMobile apps
Logcat warns that FCM has no default notification channel in AndroidManifest
Notification does not appear on Android 8 and later
This is a warning, not a crash.
3 causes, each with a fixMobile apps
Flutter Android: Failed to load FirebaseOptions from resource
Failed to load FirebaseOptions from resource. Check that you have defined values.xml correctly.
On Android, Firebase reads its settings from a values.xml file that the Google services Gradle plugin builds from google-services.json.
4 causes, each with a fix