#flutter #dart
#flutter #dart
Вопрос:
- Использую Google sign in API уже месяц
- Получение этой ошибки перед входом в Google
- Изменены правила облачного хранилища Firestore, по-прежнему показывающие те же результаты
- Ошибка API? (sign_in_failed, com.google.android.gms.common.api.ApiException: 10:, null)
E/flutter ( 8552): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: type 'PlatformException' is not a subtype of type 'String'
E/flutter ( 8552): #0 _SignInState.initState.<anonymous closure> (package:event_management/google_signin.dart:35:32)
E/flutter ( 8552): #1 _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter ( 8552): #2 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 8552): #3 _FutureListener.handleError (dart:async/future_impl.dart:160:20)
E/flutter ( 8552): #4 Future._propagateToListeners.handleError (dart:async/future_impl.dart:708:47)
E/flutter ( 8552): #5 Future._propagateToListeners (dart:async/future_impl.dart:729:24)
E/flutter ( 8552): #6 Future._completeError (dart:async/future_impl.dart:537:5)
E/flutter ( 8552): #7 _AsyncAwaitCompleter.completeError (dart:async-patch/async_patch.dart:47:15)
E/flutter ( 8552): #8 GoogleSignIn.signInSilently (package:google_sign_in/google_sign_in.dart)
E/flutter ( 8552): <asynchronous suspension>
E/flutter ( 8552): #9 _SignInState.initState (package:event_management/google_signin.dart:32:13)
E/flutter ( 8552): #10 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4684:58)
E/flutter ( 8552): #11 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
E/flutter ( 8552): #12 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #13 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #14 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #15 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #16 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #17 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
E/flutter ( 8552): #18 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
E/flutter ( 8552): #19 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4525:5)
E/flutter ( 8552): #20 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
E/flutter ( 8552): #21 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #22 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #23 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #24 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #26 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #29 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
E/flutter ( 8552): #30 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
E/flutter ( 8552): #31 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
E/flutter ( 8552): #32 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4525:5)
E/flutter ( 8552): #33 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4710:11)
E/flutter ( 8552): #34 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
E/flutter ( 8552): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #37 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #38 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #39 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #40 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5874:14)
E/flutter ( 8552): #41 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
E/flutter ( 8552): #42 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
E/flutter ( 8552): #43 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
E/flutter ( 8552): #44 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
E/flutter ( 8552): #45 Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
E/flutter ( 8552): #46 ComponentElement._firstBuild (package
Правила облачного хранилища Firestore:
`
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.time < timestamp.date(2020, 8, 31);
}
}
}
`
Комментарии:
1. Из сообщения об ошибке кажется, что вы сделали что-то вроде
print(PlatformException)
вместоprint(PlatformException.toString())
Ответ №1:
Причина:
- Эта проблема возникла, когда я переустановил Android Studio на свой внешний SSD-накопитель, поэтому значения SHA-1 изменились.
Решение:
- Снова получите SHA-1, используя команду gradlew signingReport в терминале gradlew.
- Добавьте новое значение SHA-1 в Firebase, это может решить вашу проблему.