Tre*_*ebe 9 android firebase firebase-authentication google-signin
我有一个使用firebase和firebase auth ui库的项目.问题是我无法使用Google登录登录,当我尝试加载一两秒钟然后只显示一个Toast消息"Developer Error".我可以用电子邮件和密码登录就好了.这只是签名apks的一个问题,当我调试Google时,登录工作正常.
在我的proguard-rules.pro中,我将minifyEnabled设置为false.
我已将SHA-1添加到我的firebase项目并已下载正确的json文件.
来自app level build.gradle的依赖块
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:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.firebaseui:firebase-ui-auth:3.1.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
这是我的AuthStateListener
mAuthStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
signedInInitialized();
} else {
signedOutCleanUp();
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setTheme(R.style.FirebaseSignInTheme)
.setIsSmartLockEnabled(false)
.setAvailableProviders(
Arrays.asList(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build()))
.build(),
RC_SIGN_IN);
}
}
};
Run Code Online (Sandbox Code Playgroud)
logcat没有显示任何错误或任何错误.我会在发生这种情况时发布logcat,但我不知道如何从签名的apk获取logcat,因为这只发生在apk上.
我试图解决这个问题好几天,但似乎没有头脑.
谢谢
您已在控制台中添加了调试密钥的签名.但是发布密钥的签名是不同的.添加用于在firebase控制台中对apk进行签名的释放密钥签名.
首先使用以下命令生成密钥:
keytool -list -v -keystore KEYSTORE_PATH -alias ALIAS_NAME
Run Code Online (Sandbox Code Playgroud)
然后复制SHA-1校验和并转到:
Firebase控制台>您的项目>应用程序的设置>添加指纹
| 归档时间: |
|
| 查看次数: |
2328 次 |
| 最近记录: |