android-studio googlesigninresult googlesigninclient - Cannot resolve symbol 'Auth' for google integration in android studio



3 Answers

With the latest version (2.2.2) what I had to do in order to fix this issue was to add the line below as a dependency into my app/build.gradle file

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

Hope it helps.

rc_sign_in example didn

i am new in androidstudio. i have done integration of google in eclipse but am having issues in studio. i am following step by step from this site : https://developers.google.com/identity/sign-in/android/sign-in?configured=true

but i am having an issue. i am getting an error that Cannot resolve symbol 'Auth' which i need for API and also cannot resolve 'SignInButton', see the code:

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;


public class MainActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener {
GoogleSignInOptions gso;
    GoogleApiClient mGoogleApiClient;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build();
       mGoogleApiClient = new GoogleApiClient.Builder(this)
    .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
    .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
    .build();
    }

    @Override
    public void onConnectionFailed(ConnectionResult connectionResult) {

    }
}

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:1.3.0'
        classpath 'com.google.gms:google-services:1.5.0-beta2'

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

this is my app gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.creaa.admin.googlesignin"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    apply plugin: 'com.google.gms.google-services'

}

Please help me.




I had the same issue, add compile 'com.google.android.gms:play-services-auth:10.0.1 (your project's latest version) in your app level gradle file.




I faced this issue. I solved it by adding this line in app level gradle file:

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

(at the bottom of the file (important))

and this line in app level dependencies section,

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

(latest version, at the time when I am writing this answer)

Here's the link to the documentation.




Related