android - 未解决的参考 GoogleSignIn
问题描述
我收到 GoogleSignIn 的“未解决的参考”
当前文件设置:
设置.gradle
include ':app', ':signin:app'
项目等级:
buildscript {
ext{
kotlin_version = '1.2.60'
lifecycle_version = '1.1.1'
}
repositories {
jcenter()
google()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
}
}
}
应用等级:
dependencies {
...
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
...}
最后导入:
import com.google.android.gms.auth.api.signin.GoogleSignIn
我尝试重建项目、刷新 Gradle 项目和使缓存无效,但我仍然得到未解决的 GoogleSignIn 参考。当我尝试将 play-services-gcm: 15.0.1 ' 更改为 play-services-gcm: 16.0.0 ' 时,这是最新的 Google 帐户登录,我收到一个错误:“无法解决:com.google.android .gms:play-services-gcm:16.0.0"。安装存储库和同步项目会出现另一个错误“找不到依赖项 com.google.android.gms:play-services-gcm:16.0.0”
Gradle 版本 4.4 Android 插件版本 3.1.4
解决方案
您不应该在您的项目中实现所有 google play 服务以仅使用身份验证服务
Apk文件的大小会增加,所以替换依赖如下
implementation 'com.google.android.gms:play-services-auth:16.0.0'
建议将 google-services 插件版本更新到 4.0.2
推荐阅读
- delphi - GetWindowThreadProcessId() IAT 挂钩:如何比较“dwProcessID”参数?
- apache-kafka - 何时应该将 Kafka Streams 应用程序拆分为多个应用程序?
- javascript - 'flash-messages' 不是已知元素 angular 6
- sqlite - 尝试打开 sqlite 数据库连接时出错
- sorting - OpenStreetMap 和立交桥中的排序路径
- python - 生成对应于循环值的矩阵
- c# - 我需要在 backgroundworker progresschanged 事件中使用调用吗?
- spring-webflux - 在 Spring WebFlux Web 应用程序中缓存来自 WebClient 调用的 Mono 结果
- .net-core - 我可以缩小 dotnet 发布包吗
- c - 从核心转储中获取被调用函数的返回值