简体   繁体   中英

Flutter: Internal error in Cloud Firestore (24.2.2) in Android

runing my app in debug, is not given me any issue but if run it on release it keep crashing only on Android but iOS is working perfectly...

after sign in with email and password it will just crash..

adding crashlytics make me to understand that is coming from Internal error in Cloud Firestore (24.2.2) but the code is working perfect in iOS.

here is the function i call that crash.

Future<bool> signAuth(
    {String? name,
    String? email,
    String? password,
    String? gender,
    String? university,
    String? refCode,
    String? username,
    String? type,
    BuildContext? context}) async {
  try {
    final user = (await auth.createUserWithEmailAndPassword(
            email: email!, password: password!))
        .user;
    await user!.sendEmailVerification();
    await firestore.collection('users').doc(user.uid).set({
      'id': user.uid,
      'username': username,
      'email': email,
      'name': name,
      'refCode': refCode,
      'university': university,
      'password': password.hashCode,
      'gender': gender,
      'type': type
    });
    return true;

is authenticating but not storing the datas in firestore. 授权

but not storing the remaining datas to firestore.

Error在此处输入图像描述

Incase anyone have issues that deals with Internal error in Cloud Firestore in general this will solve the problem

Step 1:

Create the of this list of file in your yourProjectName/Android/app Note: (if exit not need of creating it again)

proguard-android.txt 
proguard-rules.pro 

Step 2:

copy below config:

-keep class io.grpc.** {*;}
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

Paste the code inside the Step 1 two files created or exist.

Step 3: (then go to ==> myProjectName/Android/app/build.gradle see them by adding this line)

 buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug

//add only the below code
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //Add this to it.......
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM