-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 [firebase_auth] App crashing when calling verifyPhoneNumber on android emulator after updating firebase_auth to 0.20.0 from 0.18.4 #4651
Comments
This does look related to the Firebase Android SDK. @mikehardy thoughts - have you seen this one before? |
Indeed, it's an existing bug in current firebase-android-sdk where they are missing the androidx browser dependency required by the recaptcha android auth flow. Trigger that and you'll crash. Seen in react-native-firebase here invertase/react-native-firebase#4744 Workaround that you must use until resolved, add dependency on browser into implementation "androidx.browser:browser:1.2.0" We could consider including it in the firebase_auth build.gradle so people don't have to worry about it, with a note about when it may be removed (link to issue) but versioning may be problematic so we haven't done so in react-native-firebase either. I'm not satisfied with including it or not including it. It is not documented as a currently required workaround either, which is unsatisfying - could use a docs PR minimum |
Reproducible on the latest master flutter doctor -v[√] Flutter (Channel master, 1.26.0-2.0.pre.339, on Microsoft Windows [Version 10.0.19041.685], locale et-EE)
• Flutter version 1.26.0-2.0.pre.339 at C:\Development\flutter_master
• Framework revision 339216d186 (3 hours ago), 2021-01-14 06:45:14 -0800
• Engine revision 1b5e16cda2
• Dart version 2.12.0 (build 2.12.0-223.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\marku\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6953283\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.7.30621.155
• Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6953283
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (4 available)
• SM G950F (mobile) • ce12171c51cc001c03 • android-arm64 • Android 9 (API 28)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19041.685]
• Chrome (web) • chrome • web-javascript • Google Chrome 87.0.4280.141
• Edge (web) • edge • web-javascript • Microsoft Edge 87.0.664.75
• No issues found! LogsE/zzf (29131): Problem retrieving SafetyNet Token: 7:
W/ActivityThread(29131): handleWindowVisibility: no activity for token android.os.BinderProxy@ae93802
I/DecorView(29131): createDecorCaptionView >> DecorView@8722c68[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
W/evercode.triag(29131): Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
I/zzjy (29131): Provider GmsCore_OpenSSL not available
W/System (29131): Ignoring header X-Firebase-Locale because its value was null.
I/System.out(29131): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(29131): (HTTPLog)-Static: isSBSettingEnabled false
D/InputTransport(29131): Input channel constructed: fd=108
D/ViewRootImpl@c868c9d[RecaptchaActivity](29131): setView = DecorView@8722c68[RecaptchaActivity] TM=true MM=false
D/ViewRootImpl@3a6932c[MainActivity](29131): MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager(29131): prepareNavigationBarInfo() DecorView@3480700[MainActivity]
D/InputMethodManager(29131): getNavigationBarColor() -855310
D/ViewRootImpl@c868c9d[RecaptchaActivity](29131): dispatchAttachedToWindow
D/ViewRootImpl@c868c9d[RecaptchaActivity](29131): Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x7 surface={valid=true 479167115264} changed=true
D/mali_winsys(29131): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer(29131): eglCreateWindowSurface = 0x6f93fee280, 0x6f9095f010
D/ViewRootImpl@c868c9d[RecaptchaActivity](29131): MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
D/ViewRootImpl@c868c9d[RecaptchaActivity](29131): MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager(29131): prepareNavigationBarInfo() DecorView@8722c68[RecaptchaActivity]
D/InputMethodManager(29131): getNavigationBarColor() -855310
D/InputMethodManager(29131): prepareNavigationBarInfo() DecorView@8722c68[RecaptchaActivity]
D/InputMethodManager(29131): getNavigationBarColor() -855310
V/InputMethodManager(29131): Starting input: tba=com.nevercode.triage ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager(29131): startInputInner - Id : 0
I/InputMethodManager(29131): startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport(29131): Input channel constructed: fd=112
D/InputTransport(29131): Input channel destroyed: fd=98
D/ViewRootImpl@c868c9d[RecaptchaActivity](29131): MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 802) or=1
D/ViewRootImpl@c868c9d[RecaptchaActivity](29131): MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
D/ViewRootImpl@3a6932c[MainActivity](29131): MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
D/ViewRootImpl@3a6932c[MainActivity](29131): Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={valid=true 479429734400} changed=false
D/AndroidRuntime(29131): Shutting down VM
E/AndroidRuntime(29131): FATAL EXCEPTION: main
E/AndroidRuntime(29131): Process: com.nevercode.triage, PID: 29131
E/AndroidRuntime(29131): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/browser/customtabs/CustomTabsIntent$Builder;
E/AndroidRuntime(29131): at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth@@20.0.1:13)
E/AndroidRuntime(29131): at com.google.android.gms.internal.firebase-auth-api.zzth.zzb(com.google.firebase:firebase-auth@@20.0.1:7)
E/AndroidRuntime(29131): at com.google.android.gms.internal.firebase-auth-api.zzth.onPostExecute(Unknown Source:2)
E/AndroidRuntime(29131): at android.os.AsyncTask.finish(AsyncTask.java:695)
E/AndroidRuntime(29131): at android.os.AsyncTask.access$600(AsyncTask.java:180)
E/AndroidRuntime(29131): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
E/AndroidRuntime(29131): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(29131): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(29131): at android.app.ActivityThread.main(ActivityThread.java:7050)
E/AndroidRuntime(29131): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(29131): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/AndroidRuntime(29131): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
E/AndroidRuntime(29131): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder" on path: DexPathList[[zip file "/data/app/com.nevercode.triage-xKPS2_p4Wu7wSGzVR8DZLg==/base.apk"],nativeLibraryDirectories=[/data/app/com.nevercode.triage-xKPS2_p4Wu7wSGzVR8DZLg==/lib/arm64, /data/app/com.nevercode.triage-xKPS2_p4Wu7wSGzVR8DZLg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
E/AndroidRuntime(29131): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime(29131): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(29131): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(29131): ... 12 more
I/Process (29131): Sending signal. PID: 29131 SIG: 9
Lost connection to device. |
Enable Android Device Verification API on Google Cloud here This solves the issue |
So doing the followings will make a real device works, but not a emulator device
|
Happening on real device too (https://stackoverflow.com/questions/65839861/app-crash-while-using-firebase-phone-auth-in-android/65840172#65840172) after adding "implementation 'androidx.browser:browser:1.3.0' " in app/build.gradle it works fine |
same issue. |
@hukusuke1007 and same fix! Cheers |
@Salakar / @kroikie this could be the basis of an official PR / workaround here, firebase_auth is liable to crash both on device (under certain conditions) and emulator (every time) during phone verification without a workaround, unless the upstream bug is fixed invertase/react-native-firebase@56c653e |
Adding |
@xJon I believe that's a separate issue - if you are no longer crashing than this issue here is not your problem any longer. If SMS auto-retrieval is no longer working you might be interested in invertase/react-native-firebase#4540 |
Thanks for the reply, I actually found these 2 issues are reported over firebase/firebase-android-sdk#2318 |
@xJon thanks for that! There was no bug logged upstream until recently (vs the regression report) and I hadn't seen it yet. Very helpful for cross-linking |
This seems to be fixed on |
@markusaksli-nc - could you be specific about what workaround you mention? I ask because I don't see the upstream bug about the browser dependency marked as closed, and I don't recall mention if it in the firebase-android-sdk release notes. If they have fixed that it would be great, I could remove that dependency in my projects and from react-native-firebase/auth as well |
For me, the workaround was adding |
@mikehardy The workaround you originally mentioned - to add implementation "androidx.browser:browser:1.2.0" to the dependencies in implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' because there were some conflicts with guava otherwise. I just tried removing them both and it worked for me. |
Thanks for the success report @markusaksli-nc - I'll see about removing that from other repos, cheers |
@markusaksli-nc I still have reproducible crashes on auth without the browser dependency workaround on firebase-android-sdk 26.7.0 (current stable as of this typing) It worked for me when I just removed it from the auth module wrapping firebase however that was a false-positive. If you go in the android directory and run Two examples that were in my project, the FB SDK ( The only time it will be safe to remove the workaround is when you can have just the firebase-auth module and the firebase core module in a project by themselves, and when you do the gradle dependencies report firebase-auth itself has a dependency on androidx.browser. Until then the workaround is needed. |
Strange, I see zero results for |
@markusaksli-nc maybe not triggering the crash correctly or build environment not clean / not testing what you thought were testing? (happens a lot!) All I know is I immediately reproduced it when using firebase core + auth in absence of in-app-messaging / fbsdk (so my dependencies also did not have any andoidx.browser reference) using firebase-android-sdk 26.7.0, on an emulator (which reliably reproduces it - you can also do it on a real device that fails safetycheck I think, like a bootloader unlocked / rooted device). It crashed immediately. Add the dependency, it worked. |
Hello, I added "androidx.browser:browser:1.3.0", but it didn't help me my error:
i don't think that this error the same like author's error, but i think that they are similar my dependencies looks like
|
@ValeraSetrakov that is a completely separate error - the stack trace is only related in that is in auth, I don't think you'll see solid progress on it unless you log it separately with full details of how you reproduce what you're seeing. Hopefully in that case it gets more traction |
@mikehardy thanks for answer! I created separate issue |
I've just started experiencing this issue... Button OnPressed event exception for method call verifyPhoneNumber:
I have both SHA1 and SHA256 fingerprints in my firebase console both for debug and release mode. Tried on api 29 and 30. here are my dependency versions: |
@ivankragoff This is an assertion:
This appears concrete and in contradiction to your assertion:
I would triple-check your assertion, it appears something is wrong with your certificate hash configuration. |
When i added this dependency to android it worked after the browser checked im not a robot . i dont know if it is supposed to be like this is flutter or not ! |
@kmelliti In flutter you have to add it yourself I believe, the package doesn't hide this underlying problem for you, as it is not in the package's android/build.gradle: You may wish to subscribe to firebase/firebase-android-sdk#2164 in order to know when this workaround may be removed For anyone else reading this, as @markusaksli-nc mentions you may also need a guava dependency to avoid some known conflicts - you'll know via the android build failure if you need it, he noted it here: #4651 (comment) |
@ivankragoff After hours of trial and errors I found this problem. You may have set all correct in the firebase but there still might be problem from Google cloud platform. Visit Google Cloud Platform -> APIs & Services -> Credentials. Look for OAuth 2.0 Client Id Section. You must find your Android Client for your package name. If not you are missing those. So hit the 'Create Credentials' -> 0Auth Client Id -> Application Type : Android Client. Name it anything. Now provide one Android Client sha1 with your release sha1 Key and then another one for debug sha1 key. For just GCP reason I named my android client like (automatic created). |
@Yunus0or1 lifesaver! Worked like a charm in my case |
@Yunus0or1 well that is unexpected, great note. If there is some place this could be mentioned in the docs the GitHub web UI makes text pull request creations (like to doc files) really easy, usually just a couple clicks |
Very unfortunate to see something like this from the devs. The error response was 'BAD_CERT_HASH'. As the final checks happen in Google cloud platform they could provide additional error information like 'No Credential found. Please visit and check Google Cloud Platform', it would definitely save our time. |
@Yunus0or1 sounds like a great opportunity to open an issue with the firebase-android-sdk - which we depend on here as our underlying implementation - to improve their error message! We unfortunately are not in control of the underlying SDK as we're just wrapping it in Dart for Flutter, and passing the error message through. |
If you are trying @Yunus0or1 solution. After hitting 'Create credentials', you first have to create Auth Consent Screen before adding an android client. |
@ivankragoff @Yunus0or1 both of you are the real saviours to me .. i was running behind sha1 and sha 256 and some of the gradle dependencies .. OMG finally i solve it by correcting my SHA1 in the google cloud console of the respective project and worked like a charm. In-fact i am using React Native to build my project , even then this is the apt solution |
For anyone getting the captcha flow on every sign in, double check you've setup SafetyNet correctly: |
I believe this has now been fixed with firebase android BOM >= 28.0.0 release which latest |
Yes confirmed fixed w/BoM28+ I verified it against the corresponding react-native-firebase bug via inspection of |
I simply fix it by removing the platform from your google firebase console and recreate a new one again. Works like charm |
This is what was causing the bug. I had copied code from another perfectly working project, then I thought once your activate SafetyNet for your gmail account, it works across all your firebase projects but that was wrong. Make sure you activate SafetyNet for each project. Thanks @acoutts |
Bug report
Describe the bug
After updating my flutter application to use firebase_auth 0.20.0, the app is crashing on my Android emulator (API 29).
The app does not crash on startup, but just after the phone verification method is invoked.
The issue maybe related to firebase-android-sdk issue.
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
This is the console log when the app crashes.
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
The text was updated successfully, but these errors were encountered: