简体   繁体   中英

Cannot resolve symbol GOOGLE_SIGN_IN_API.. Google sign-in in my app, Unable to access variable Auth.GOOGLE_SIGN_IN_API

I've been integrating Google Sign-In into my Android App. I have been following the Android tuorial from Google. ( https://developers.google.com/identity/sign-in/android/sign-in ) During the process I encountered this problem.

// Build a GoogleApiClient with access to the Google Sign-In API and the // options specified by gso.

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

Cannot resolve symbol GOOGLE_SIGN_IN_API This is the problem I'm facing.

I've been strictly following all the steps as described in the above mentioned link. All the dependencies and plug ins are all same still the issue exists. How can I resolve this issue and move forward? Any answers will be highly appreciated..

***************UPDATE*************** This is my app 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' 

This is my project gradle

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

update your gradle file

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

Replace your gradle dependences with this and let me know in case of any query

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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