buildscript { dependencies { classpath 'com.google.gms:google-services:4.3.5' } }
apply plugin: 'com.google.gms.google-services'
示例代码: project的build.gradle文件:
buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.2.1' classpath 'com.google.gms:google-services:4.3.5' } }
allprojects { repositories { google() jcenter() } }
app或module的build.gradle文件:
apply plugin: 'com.android.application'
android { ... }
dependencies { ... }
apply plugin: 'com.google.gms.google-services'
注意:插件版本可能会有所不同,所以请根据自己的需要进行修改。