작성
·
667
0
선생님
제가 코딩을 하고 돌리는데 이뮬레이터에서 google sign in 버튼을 누르면 아무것도 동작을 하지 않습니다. 밑에 저 코드가 문제인 것 같은데
E/flutter (31681): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: type 'User' is not a subtype of type 'FirebaseUser'
처음에 돌렸을 때는 로그인 화면이 떠서 로그인을 했더니 그다음에 제 앱에 들어가지지 않아 중지하고 다시 돌렸는데 들어가지지 않습니다.
밑에 질문을 참고해서 FireBase auth 라이브러리도 최신버전으로 했는데 혹시 무슨 문제인지 알 수 있을까요?
답변 8
0
0
그럼 라이브러리 버전간의 문제가 있었던 것 같네요.
일단 저랑 맞췄는데도 안 된다면 로그인 코드를 확인해 보셔야 할 듯 하네요. 로그인 버튼 눌렀을 때 _handleSignIn() 만 하시면 됩니다.
https://github.com/junsuk5/flutter_insta_clon/blob/master/lib/login_page.dart
그리고 rootPage도 확인해 보세요.
https://github.com/junsuk5/flutter_insta_clon/blob/master/lib/root_page.dart
0
혹시 버전에 문제가 있나 생각해서 모든 버전을 선생님하고 동일하게 했습니다.
그리고 main()도 선생님처럼 같은 코드를 짜고 firbase_core 라이브러리도 없애고 돌렸는데 에러같은건 안뜨는데 로그인 버튼을 누른 뒤 화면 전환이 안되는거 같습니다.
Plugin project :firebase_core_web not found. Please update settings.gradle.
ERROR: [TAG] Failed to resolve variable '${animal.sniffer.version}'
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Waiting for AOSP on IA Emulator to report its views...
Debug service listening on ws://127.0.0.1:50330/xssZE728AAw=/ws
Syncing files to device AOSP on IA Emulator...
I/Choreographer( 1300): Skipped 31 frames! The application may be doing too much work on its main thread.
D/EGL_emulation( 1300): eglMakeCurrent: 0xe5986320: ver 3 0 (tinfo 0xcf3d6a20)
D/eglCodecCommon( 1300): setVertexArrayObject: set vao to 0 (0) 1 2
D/EGL_emulation( 1300): eglMakeCurrent: 0xebb09440: ver 3 0 (tinfo 0xcf3d65d0)
D/eglCodecCommon( 1300): setVertexArrayObject: set vao to 0 (0) 1 0
I/flutter ( 1300): root_page created
W/ActivityThread( 1300): handleWindowVisibility: no activity for token android.os.BinderProxy@c5dd27a
D/EGL_emulation( 1300): eglMakeCurrent: 0xe5986320: ver 3 0 (tinfo 0xcf3d6a20)
D/EGL_emulation( 1300): eglMakeCurrent: 0xe5986320: ver 3 0 (tinfo 0xcf3d6a20)
W/BiChannelGoogleApi( 1300): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@e1ede30
W/BiChannelGoogleApi( 1300): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@e1ede30
W/BiChannelGoogleApi( 1300): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@e1ede30
D/FirebaseAuth( 1300): Notifying id token listeners about user ( XgtWdNUrQTQknsTKYky7Rms6t7O2 ).
I/flutter ( 1300): signed injyjang0421@naver.com
I/flutter ( 1300): FirebaseUser({uid: XgtWdNUrQTQknsTKYky7Rms6t7O2, photoUrl: https://lh5.googleusercontent.com/-tc_cHNb1Tp0/AAAAAAAAAAI/AAAAAAAAAAA/XK-0YT8_w5M/s96-c/photo.jpg, isAnonymous: false, providerData: [{uid: XgtWdNUrQTQknsTKYky7Rms6t7O2, photoUrl: https://lh5.googleusercontent.com/-tc_cHNb1Tp0/AAAAAAAAAAI/AAAAAAAAAAA/XK-0YT8_w5M/s96-c/photo.jpg, providerId: firebase, displayName: jyjang0421@naver.com, email: jyjang0421@naver.com}, {uid: 104897146605634044863, photoUrl: https://lh5.googleusercontent.com/-tc_cHNb1Tp0/AAAAAAAAAAI/AAAAAAAAAAA/XK-0YT8_w5M/s96-c/photo.jpg, providerId: google.com, displayName: jyjang0421@naver.com, email: jyjang0421@naver.com}], providerId: firebase, displayName: jyjang0421@naver.com, creationTimestamp: 1598506273166, lastSignInTimestamp: 1598547568048, email: jyjang0421@naver.com, isEmailVerified: true}) 문구는 이렇게 뜹니다.
0
선생님 일단 제가 firebase_auth: ^0.18.0+1로 돌렸었는데요 선생님 말대로 버전을 낮춰서 pub get을 했는데
Because firebase_auth >=0.10.0 <0.15.5 depends on firebase_core ^0.4.0 and instagram_clone depends on firebase_core ^0.5.0, firebase_auth >=0.10.0 <0.15.5 is forbidden.
So, because instagram_clone depends on firebase_auth ^0.14.0+5, version solving failed.
pub get failed (1; So, because instagram_clone depends on firebase_auth ^0.14.0+5, version solving failed.)
이런 문구가 떠서 firebase_core 버전을 0.4.0으로 낮춰서 돌렸습니다. 그랬더니
Plugin project :firebase_core_web not found. Please update settings.gradle.
lib/main.dart:8:9: Error: Getter not found: 'Firebase'.
await Firebase.initializeApp();
^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script '/Users/jangjaeyeong/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 896
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/jangjaeyeong/development/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1
이런 문제가 떴습니다.
이런 말이 뜹니다.
0
에러메시지의 라인 번호에 해당하는 코드 확인이 안 되어 어느 부분이 문제인지 모르겠네요.
코드는 제 코드와 같기 때문에
라이브러리 버전을 제꺼와 동일하게 해도 같은 에러가 발생하는지 확인해 보시겠어요?
firebase_auth: ^0.14.0+5 |
0
추가적으로 전체적인 에러를 다 보여드리면
W/ActivityThread(31681): handleWindowVisibility: no activity for token android.os.BinderProxy@f6728d8
D/EGL_emulation(31681): eglMakeCurrent: 0xe59861a0: ver 3 0 (tinfo 0xe5983cb0)
D/EGL_emulation(31681): eglMakeCurrent: 0xe59861a0: ver 3 0 (tinfo 0xe5983cb0)
I/BiChannelGoogleApi(31681): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq@4920592
D/FirebaseAuth(31681): Notifying id token listeners about user ( XgtWdNUrQTQknsTKYky7Rms6t7O2 ).
E/flutter (31681): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: type 'User' is not a subtype of type 'FirebaseUser'
E/flutter (31681): #0 _LoginPageState._handleSignin (package:instagram_clone/login_page.dart:49:18)
E/flutter (31681):
E/flutter (31681): #1 _LoginPageState.build.
E/flutter (31681): #2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:992:19)
E/flutter (31681): #3 _InkResponseState.build.
E/flutter (31681): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:184:24)
E/flutter (31681): #5 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:524:11)
E/flutter (31681): #6 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:284:5)
E/flutter (31681): #7 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:219:7)
E/flutter (31681): #8 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:477:9)
E/flutter (31681): #9 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:78:12)
E/flutter (31681): #10 PointerRouter._dispatchEventToRoutes.
E/flutter (31681): #11 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
E/flutter (31681): #12 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:122:18)
E/flutter (31681): #13 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:108:7)
E/flutter (31681): #14 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:220:19)
E/flutter (31681): #15 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:200:22)
E/flutter (31681): #16 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:158:7)
E/flutter (31681): #17 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:104:7)
E/flutter (31681): #18 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:88:7)
E/flutter (31681): #19 _rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter (31681): #20 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (31681): #21 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (31681): #22 _invoke1 (dart:ui/hooks.dart:267:10)
E/flutter (31681): #23 _dispatchPointerDataPacket (dart:ui/hooks.dart:176:5)
E/flutter (31681):
E/eglCodecCommon(31681): goldfish_dma_create_region: could not obtain fd to device! fd 0 errno=11
E/Surface (31681): getSlotFromBufferLocked: unknown buffer: 0x0
W/libEGL (31681): EGLNativeWindowType 0xd25ff008 disconnect failed
D/EGL_emulation(31681): eglMakeCurrent: 0xe2d6d6a0: ver 3 0 (tinfo 0xe59837b0)
D/EGL_emulation(31681): eglMakeCurrent: 0xe59861a0: ver 3 0 (tinfo 0xe5983cb0)
D/EGL_emulation(31681): eglMakeCurrent: 0xe2d6d6a0: ver 3 0 (tinfo 0xe59837b0)
D/eglCodecCommon(31681): setVertexArrayObject: set vao to 0 (0) 25 0
입니다.
0
에러가 발생한 부분 코드입니다.
Future_handleSignin() async{
GoogleSignInAccount gooleUser = await _googleSignIn.signIn();
GoogleSignInAuthentication googleAuth = await gooleUser.authentication;
FirebaseUser user =(await _auth.signInWithCredential(
GoogleAuthProvider.getCredential(
idToken: googleAuth.idToken, accessToken: googleAuth.accessToken))).user;
print("signed in" + user.displayName);
return user;
}
코드부분은 선생님께서 올려주신 깃헙을 보고 다시 맞춰서 코드를 짰습니다.
0
에러메시지만 봤을 때 FirebaseUser 타입을 User 타입 변수에 대입하려고 해서 발생한 에러 같습니다.
에러가 발생한 부분의 코드를 보여주시면 좀 더 알려드릴 수 있을 것 같습니다.