以上是我根据我的要求添加的依赖项。
以下是我正在使用的Google Play服务依赖项。 - 实施'com.google.android.gms:play-services:12.0.1'
我还在最后添加了“apply plugin”语句 - 申请插件:'com.google.gms.google-services'
请帮我解决错误!
答案 0 :(得分:0)
您是否要在build.gradle(根级别)中导入Google服务?
build.gradle
根级别
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
build.gradle
应用级别
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
implementation 'com.google.android.gms:play-services:12.0.1'
// ...
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-invites:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'