首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到符号类GoogleSignInApi

找不到符号类GoogleSignInApi
EN

Stack Overflow用户
提问于 2016-12-22 10:44:38
回答 0查看 6.7K关注 0票数 3

我正在尝试为Firebase设置与谷歌的身份验证,并遵循此document

但是我得到了这些错误:

代码语言:javascript
复制
error: cannot find symbol class GoogleSignInApi
error: cannot find symbol variable RC_SIGN_IN

我的build.gradle (应用程序)

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

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.myapp.sc"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.firebaseui:firebase-ui:1.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.google.android.gms:play-services-auth:10.0.1'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

MainActivity.java

代码语言:javascript
复制
private FirebaseAuth mAuth;
private AuthStateListener mAuthListener;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // setup google sign in
    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(getString(R.string.clientId)).requestEmail().build();
    GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this, (OnConnectionFailedListener) this)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso).build();

    if (mAuth.getCurrentUser() == null) {
        signIn(mGoogleApiClient);
    }
}

private void signIn(GoogleApiClient mGoogleApiClient) {
    Intent signInIntent = new Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
    startActivityForResult(signInIntent, RC_SIGN_IN);
}

我尝试过清理/重建项目和使缓存失效,但没有解决这个问题。我是不是漏掉了什么?

EN

回答

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

https://stackoverflow.com/questions/41275037

复制
相关文章

相似问题

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