无法解析符号GOOGLE_SIGN_IN_API .. Google在我的应用中登录,无法访问变量Auth.GOOGLE_SIGN_IN_API

时间:2017-05-22 12:27:06

标签: android oauth google-signin android-googleapiclient googlesigninapi

我已将Google登录整合到我的Android应用中。 我一直关注谷歌的Android tuorial。 (https://developers.google.com/identity/sign-in/android/sign-in) 在这个过程中我遇到了这个问题。

//建立一个GoogleApiClient,可以访问Google登录API和 //由gso指定的选项。

mGoogleApiClient = new GoogleApiClient.Builder(this)
    .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
    .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
    .build();

无法解析符号GOOGLE_SIGN_IN_API 这是我面临的问题。

我一直严格遵循上述链接中描述的所有步骤。所有依赖项和插件都是相同的仍然存在问题。我该如何解决这个问题并继续前进?任何答案都将受到高度赞赏..

*************** UPDATE *************** 这是我的应用程序gradle



apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    defaultConfig {
        applicationId 'com.cloudtree.glue'
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 3
        versionName "1.2"
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            lintOptions {
                disable 'MissingTranslation'
            }
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/google-play-services.jar')
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.daimajia.swipelayout:library:1.2.0@aar'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:cardview-v7:23.0.1'
    compile 'com.android.support:multidex:1.0.0'
    compile files('libs/httpclient-4.2.1.jar')
    compile files('libs/httpcore-4.2.1.jar')
    compile files('libs/apache-mime4j-core-0.7.2.jar')
    compile files('libs/httpmime-4.2.1.jar')
    compile project(':volley')
    compile project(':mediapicker')
    compile 'com.android.support:support-v4:18.0.+'
    compile 'com.google.android.gms:play-services-auth:9.8.0'

}

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




这是我的项目格斗



// 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()
    }
}




2 个答案:

答案 0 :(得分:0)

更新您的gradle文件

    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.google.android.gms:play-services:10.2.0'

答案 1 :(得分:0)

用此替换您的gradle依赖关系并在有任何查询的情况下通知我

compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/httpclient-4.2.1.jar')
compile files('libs/httpcore-4.2.1.jar')
compile files('libs/apache-mime4j-core-0.7.2.jar')
compile files('libs/httpmime-4.2.1.jar')
compile project(':volley')
compile project(':mediapicker')
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.android.gms:play-services-auth:9.8.0'