- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试使用 Google for Firebase 设置身份验证并遵循此 document .
但是我遇到了这些错误:
error: cannot find symbol class GoogleSignInApi
error: cannot find symbol variable RC_SIGN_IN
我的build.gradle(应用程序)
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'
主 Activity .java
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);
}
我已经尝试清理/重建项目并使缓存失效,但它并没有解决问题。有什么我想念的吗?
最佳答案
添加这一行:
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
取而代之的是:
Intent signInIntent = new Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
并添加:
private static int RC_SIGN_IN = 100;
还需要:
import com.google.android.gms.auth.api.Auth;
关于android - 找不到符号类 GoogleSignInApi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41275037/
我正在尝试使用 Google for Firebase 设置身份验证并遵循此 document . 但是我遇到了这些错误: error: cannot find symbol class Google
当尝试为我的应用程序使用 GoogleSignInApi 时,它会抛出以下异常:java.lang.RuntimeException: 传递结果失败 ResultInfo{who=null, requ
我正在使用 play services 8.3 中引入的新 GoogleSignInApi。它会记住上次选择的帐户,并且从第二次开始不会显示帐户选择器。但我希望它让用户每次都选择帐户。看起来 Goog
我发现为了让用户登录,我必须使用以下代码: Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
我的目标是使用 Google plus sdk 登录到 BaaS,BaaS 需要通过 googleSignInAccount.getIdToken() 获取的 tokenId 和 accessToke
我正在创建一个简单的 android 应用程序,用于发送适用于语音输入的百叶窗电子邮件。应用程序不与发送邮件的普通 gmail/电子邮件应用程序交互。我使用 GoogleSignInApi 来避免无效
我知道有几篇文章讨论 Android 的登录/oauth,但没有一个能解决我的问题。 我正在努力使用 Google Sheets v4 教程中的 AccountManager 来协调 GoogleSi
您好,这可能是一个愚蠢的问题,但我就是找不到这两个 API 之间的区别。 On 似乎完全按照另一个做。我试着在谷歌开发者网站上阅读,但它只是令人困惑。 我想使用 Google+ 方便地登录我的应用程序
使用 Play 服务 8.4,方法 getCurrentPerson已弃用,我使用 PeopleApi 获取用户的名字、姓氏和性别。 谁能告诉我如何使用其他方法获取已登录用户的信息? 最佳答案 更新:
我是一名优秀的程序员,十分优秀!