buildscript { repositories { // Check that you have the following line (if not, add it): google() // Google's Maven repository } dependencies { ... // Add the following line: classpath 'com.google.gms:google-services:4.3.4' // Google Services plugin } }
allprojects { ... repositories { // Check that you have the following line (if not, add it): google() // Google's Maven repository ... } }
apply plugin: 'com.android.application' // Add the following line: apply plugin: 'com.google.gms.google-services' // Google Services plugin
如果您尝试使用 Firebase Realtime Database,还需要确保在应用清单文件中添加以下行:
然后关闭并重新打开该应用,重新连接 Firebase 数据库,问题就应该得到解决了。