相关疑难解决方法(0)

为Flutter应用程序生成SHA-1

我正在尝试为Flutter应用程序生成SHA-1,Android工作室支持Google登录,但我不知道该怎么做,我看到一些帖子表明要运行命令,但我需要我猜是一个jks文件,而且颤动并没有创造出来.

有人能帮助我吗?

dart flutter

18
推荐指数
14
解决办法
2万
查看次数

PlatformException (PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 12500: , null))

将要崩溃的行:

GoogleSignInAccount googleUser = await _googleSignIn.signIn();
Run Code Online (Sandbox Code Playgroud)

我试过什么:

  1. 我用这个命令生成了我的 SH1 密钥 keytool -list -v \ -alias androiddebugkey -keystore ~/.android/debug.keystore
  2. 将 SH1 加密添加到 console.firebase.google.com
  3. 重新下载 google-service.json
  4. 复制debug.keystore.androidMyProject/android
  5. 在调试和发布中运行
  6. 添加到android/build.gradle这些行中:

    • 类路径 'com.android.tools.build:gradle:3.2.1'
    • 类路径 'com.google.gms:google-services:4.2.0'
  7. 添加到android/app/build.gradle这一行:

    • 依赖下的实现 'com.google.firebase:firebase-core:16.0.9'
    • 应用插件:文件末尾的“com.google.gms.google-services”
  8. release-signing.properties在我的项目文件夹下创建一个文件,其中包含这些行。
    • storeFile=debug.keystore
    • keyAlias=androiddebugkey
    • 商店密码=安卓
    • 密钥密码=安卓

另外,我已经在所有 StackOverflow问题中搜索了我能找到的这个问题,但没有一个对我有用。

我的 pubspec.yaml:

firebase_core: ^0.4.0+1
firebase_analytics: ^3.0.1

cloud_firestore: ^0.11.0+2

firebase_auth: ^0.11.1
google_sign_in: ^4.0.1+3

rxdart: ^0.22.0
Run Code Online (Sandbox Code Playgroud)

认证类:

class AuthService {
  final GoogleSignIn …
Run Code Online (Sandbox Code Playgroud)

dart google-signin flutter googlesigninaccount googlesigninapi

12
推荐指数
5
解决办法
1万
查看次数

Flutter:使用 google_sign_in 时出现 PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)

我已按照此处的所有步骤进行操作,还在 firebase 控制台中添加了 SHA1 密钥。

这是我的代码

void handleGoogleSignIn() async {
   String errorMessage = "success";

   GoogleSignInAccount _googleSignInAccount = await _googleSignIn.signIn();
   GoogleSignInAuthentication googleSignInAuthentication =
   await _googleSignInAccount.authentication;
   AuthCredential _credential = GoogleAuthProvider.getCredential(
       idToken: googleSignInAuthentication.idToken,
       accessToken: googleSignInAuthentication.accessToken);
   try {
     AuthResult _authResult = await _auth.signInWithCredential(_credential);
   } catch (error) {
     switch (error.code) {
       case "ERROR_INVALID_CREDENTIAL":
         errorMessage = "Invalid credentials";
         break;
       case "ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL":
         errorMessage = "This accouont exists withother credentials";
         break;
       case "ERROR_OPERATION_NOT_ALLOWED":
         errorMessage = "Signing in with Email and Password is not enabled.";
         break;
       default:
         errorMessage …
Run Code Online (Sandbox Code Playgroud)

android firebase google-signin flutter

6
推荐指数
1
解决办法
2万
查看次数