首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >谷歌登录的GoogleApiClient

谷歌登录的GoogleApiClient
EN

Stack Overflow用户
提问于 2017-05-31 06:55:48
回答 1查看 116关注 0票数 1

我研究了一段时间,没有发现任何有用的东西。我几乎完成了我的应用程序,我希望添加谷歌登录功能。我没有要求任何人为我纠正我的密码。我只需要被指引到正确的方向。每个网站,包括android开发者网站,都没有得到任何帮助。如果你能提供任何帮助,我们将不胜感激。再说一遍,我只需要被指向正确的方向,而不是为我编写代码。

做了答案告诉我的,得到了这个错误代码。首先它告诉我改为10.2.1,然后9.0.0:

错误:任务执行失败“:app:processDebugGoogleServices”。

请通过更新google插件的版本(有关最新版本的信息可在https://bintray.com/android/android-tools/com.google.gms.google-services/上获得)或将com.google.android.gms的版本更新为9.0.0来解决版本冲突。

这是我的分级文件:

代码语言:javascript
复制
apply plugin: 'com.android.application'

android {
signingConfigs {
    config {
        keyAlias 'cm'
        keyPassword 'cr3101120$$'
        storeFile file('C:/Users/Carter/AndroidStudioProjects/ColorMatch/release.jks')
        storePassword 'cr3101120$$'
    }
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "carsquared.colormatch"
    minSdkVersion 19
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        zipAlignEnabled true
    }
    debug {
        signingConfig signingConfigs.config
        zipAlignEnabled true
    }
}
productFlavors {
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
apply plugin: 'com.google.gms.google-services'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-messaging:10.2.6'
compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'

}
apply plugin: 'com.google.gms.google-services'

这是主要的等级:

代码语言:javascript
复制
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.2'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-31 07:11:08

  1. 请在这里注册,https://developers.google.com/mobile/add?platform=android&cntapi=signin&cnturl=https:%2F%2Fdevelopers.google.com%2Fidentity%2Fsign-in%2Fandroid%2Fsign-in%3Fconfigured%3Dtrue&cntlbl=Continue%20Adding%20Sign-In
  2. 创建应用程序和填充包名和SHA1
  3. SHA1从您的系统生成,如下所示 a.生成签名的apk.(带有JKS文件) 打开cmd选择以下路径"AndroidSetup\jre\bin“ c.运行这个coomand keytool -exportcert -list -v -keystore E:\JKSFile\GoEthno.jks E:\JKSFile\GoEthno.jks = your jks file path d.Copy SHA-1及粘贴于固定位置
  4. 从url上启用Google登录
  5. 生成Google服务json
  6. 将Google service json放在android项目的app文件夹中。

添加此依赖项依赖项

{ // .. compile 'com.google.android.gms:play-services-auth:9.2.1' // glide is added to load the g+ profile image. Ignore if you want compile 'com.github.bumptech.glide:glide:3.7.0' } apply plugin: 'com.google.gms.google-services'

您可以在这里看到google注册的其余代码,http://www.androidhive.info/2014/02/android-login-with-google-plus-account-1/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44277707

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档