简体   繁体   English

未解决的参考GoogleSignIn

[英]Unresolved reference GoogleSignIn

I'm getting "Unresolved reference" for GoogleSignIn 我收到有关GoogleSignIn的“未解决的参考”

The current files set up: 当前文件设置:

settings.gradle settings.gradle

include ':app', ':signin:app'

project gradle: 项目gradle:

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/'
    }
}
}

app gradle: 应用程式gradle:

dependencies {
...
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
...}

and finally import: 最后导入:

import com.google.android.gms.auth.api.signin.GoogleSignIn

I tried to rebuild Project, Refresh Gradle Projects and Invalidate caches and I still get Unresolved reference for GoogleSignIn. 我尝试重建Project,刷新Gradle项目和使缓存无效,但仍然获得GoogleSignIn的未解决参考。 When I tried to change play-services-gcm: 15.0.1 ' to play-services-gcm: 16.0.0 ', which is the newest Google Account Login, I get an error: "Failed to resolve: com.google.android.gms:play-services-gcm:16.0.0". 当我尝试将play-services-gcm: 15.0.1 '更改为play-services-gcm: 16.0.0 ',这是最新的Google帐户登录名时,出现错误:“无法解决:com.google.android .gms:play-services-gcm:16.0.0“。 Installing repository and sync projects gives another error "Could not find dependency com.google.android.gms:play-services-gcm:16.0.0" 安装存储库和同步项目会出现另一个错误“找不到依赖项com.google.android.gms:play-services-gcm:16.0.0”

Gradle version 4.4 Android Plugin Version 3.1.4 Gradle版本4.4 Android插件版本3.1.4

You should not implement all google play services in your project for use only auth service 您不应该在项目中实施所有Google Play服务,仅用于身份验证服务

The size of the Apk file will increase, so replace the dependency as below Apk文件的大小将增加,因此请按如下所示替换依赖项

implementation 'com.google.android.gms:play-services-auth:16.0.0'

And it is advisable update google-services Plugin Version to 4.0.2 并且建议将google-services插件版本更新为4.0.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM