_apply plugin: 'com.google.gms.google-services'_ 有什么作用?

What does _apply plugin: 'com.google.gms.google-services'_ do?

添加 apply plugin: 'com.google.gms.google-services' 有什么作用?如果我评论这个,我的应用程序仍然会编译并且 运行。有关将 Firebase 添加到项目的更多信息 here.

它会按照 here. It also adds a compile dependency on firebase-core if not already present. That dependency will cause FirebaseInitProvider to get merged into your manifest, which is responsible for initializing a default FirebaseApp 在应用程序启动时使用它在构建阶段读取的资源的说明从 google-services.json 文件中读取资源。

如果您想了解有关 Firebase 应用初始化的更多信息,请阅读: