Skip to content
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

Closed
mbilalakmal opened this issue Jan 13, 2021 · 40 comments
Labels
plugin: auth type: bug Something isn't working type: crash A compile error or crash

Comments

@mbilalakmal
Copy link
Contributor

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.

Syncing files to device Android SDK built for x86...
Restarted application in 1,891ms.
I/flutter ( 6856): MyApp development built
W/DynamiteModule( 6856): Local module descriptor class for providerinstaller not found.
I/DynamiteModule( 6856): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller( 6856): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
D/ApplicationLoaders( 6856): Returning zygote-cached class loader: /system/framework/android.hidl.base-V1.0-java.jar
D/ApplicationLoaders( 6856): Returning zygote-cached class loader: /system/framework/android.hidl.manager-V1.0-java.jar
D/ApplicationLoaders( 6856): Returning zygote-cached class loader: /system/framework/android.hidl.base-V1.0-java.jar
I/arcab.karcabbe( 6856): The ClassLoaderContext is a special shared library.
I/chatty  ( 6856): uid=10134(com.karcab.karcabber) AsyncTask #1 identical 1 line
I/arcab.karcabbe( 6856): The ClassLoaderContext is a special shared library.
I/arcab.karcabbe( 6856): The ClassLoaderContext is a special shared library.
W/arcab.karcabbe( 6856): Accessing hidden field Ldalvik/system/BaseDexClassLoader;->pathList:Ldalvik/system/DexPathList; (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden field Ldalvik/system/DexPathList;->nativeLibraryDirectories:Ljava/util/List; (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden field Ldalvik/system/DexPathList;->systemNativeLibraryDirectories:Ljava/util/List; (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden field Ldalvik/system/DexPathList;->nativeLibraryPathElements:[Ldalvik/system/DexPathList$NativeLibraryElement; (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Ldalvik/system/DexPathList;->makePathElements(Ljava/util/List;)[Ldalvik/system/DexPathList$NativeLibraryElement; (greylist, reflection, allowed)
V/NativeCrypto( 6856): Registering com/google/android/gms/org/conscrypt/NativeCrypto's 284 native methods...
W/arcab.karcabbe( 6856): Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (greylist, reflection, allowed)
I/ProviderInstaller( 6856): Installed default security provider GmsCore_OpenSSL
I/flutter ( 6856): MyApp development built
I/flutter ( 6856): AuthBuilder built
I/AssistStructure( 6856): Flattened final assist data: 464 bytes, containing 1 windows, 3 views
W/IInputConnectionWrapper( 6856): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6856): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6856): getTextAfterCursor on inactive InputConnection
E/zzf     ( 6856): Problem retrieving SafetyNet Token: 7: 
W/ActivityThread( 6856): handleWindowVisibility: no activity for token android.os.BinderProxy@26ff068
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J (greylist,core-platform-api, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Llibcore/io/Memory;->peekLong(JZ)J (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Llibcore/io/Memory;->pokeLong(JJZ)V (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Llibcore/io/Memory;->pokeInt(JIZ)V (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Llibcore/io/Memory;->peekInt(JZ)I (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Llibcore/io/Memory;->pokeByte(JB)V (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Llibcore/io/Memory;->peekByte(J)B (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Llibcore/io/Memory;->pokeByteArray(J[BII)V (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Llibcore/io/Memory;->peekByteArray(J[BII)V (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->arrayBaseOffset(Ljava/lang/Class;)I (greylist,core-platform-api, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->arrayIndexScale(Ljava/lang/Class;)I (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden field Ljava/nio/Buffer;->address:J (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, reflection, allowed)
W/zzdk    ( 6856): keyset not found, will generate a new one
W/zzdk    ( 6856): java.io.FileNotFoundException: can't read keyset; the pref value GenericIdpKeyset does not exist
W/zzdk    ( 6856): 	at com.google.android.gms.internal.firebase-auth-api.zzdo.zzc(com.google.firebase:firebase-auth@@20.0.1:10)
W/zzdk    ( 6856): 	at com.google.android.gms.internal.firebase-auth-api.zzdo.zzb(com.google.firebase:firebase-auth@@20.0.1:1)
W/zzdk    ( 6856): 	at com.google.android.gms.internal.firebase-auth-api.zzat.zzi(com.google.firebase:firebase-auth@@20.0.1:1)
W/zzdk    ( 6856): 	at com.google.android.gms.internal.firebase-auth-api.zzdj.zzi(com.google.firebase:firebase-auth@@20.0.1:1)
W/zzdk    ( 6856): 	at com.google.android.gms.internal.firebase-auth-api.zzdj.zzd(com.google.firebase:firebase-auth@@20.0.1:2)
W/zzdk    ( 6856): 	at com.google.firebase.auth.internal.zzk.<init>(com.google.firebase:firebase-auth@@20.0.1:7)
W/zzdk    ( 6856): 	at com.google.firebase.auth.internal.zzk.zza(com.google.firebase:firebase-auth@@20.0.1:3)
W/zzdk    ( 6856): 	at com.google.firebase.auth.internal.RecaptchaActivity.zzd(com.google.firebase:firebase-auth@@20.0.1:9)
W/zzdk    ( 6856): 	at com.google.android.gms.internal.firebase-auth-api.zzth.<init>(com.google.firebase:firebase-auth@@20.0.1:13)
W/zzdk    ( 6856): 	at com.google.firebase.auth.internal.RecaptchaActivity.onResume(com.google.firebase:firebase-auth@@20.0.1:43)
W/zzdk    ( 6856): 	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1446)
W/zzdk    ( 6856): 	at android.app.Activity.performResume(Activity.java:7939)
W/zzdk    ( 6856): 	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4195)
W/zzdk    ( 6856): 	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4237)
W/zzdk    ( 6856): 	at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
W/zzdk    ( 6856): 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
W/zzdk    ( 6856): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
W/zzdk    ( 6856): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
W/zzdk    ( 6856): 	at android.os.Handler.dispatchMessage(Handler.java:107)
W/zzdk    ( 6856): 	at android.os.Looper.loop(Looper.java:214)
W/zzdk    ( 6856): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
W/zzdk    ( 6856): 	at java.lang.reflect.Method.invoke(Native Method)
W/zzdk    ( 6856): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
W/zzdk    ( 6856): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Ljava/security/spec/ECParameterSpec;->setCurveName(Ljava/lang/String;)V (greylist, reflection, allowed)
W/System  ( 6856): Ignoring header X-Firebase-Locale because its value was null.
D/EGL_emulation( 6856): eglMakeCurrent: 0xdbae4bc0: ver 2 0 (tinfo 0xdbb1a0e0)
W/arcab.karcabbe( 6856): Accessing hidden field Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (greylist,core-platform-api, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden field Ljava/io/FileDescriptor;->descriptor:I (greylist, JNI, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/security/x509/AlgorithmId;->get(Ljava/lang/String;)Lsun/security/x509/AlgorithmId; (greylist, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Lsun/security/x509/AlgorithmId;->getName()Ljava/lang/String; (greylist,core-platform-api, reflection, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Ldalvik/system/BlockGuard;->getThreadPolicy()Ldalvik/system/BlockGuard$Policy; (greylist,core-platform-api, linking, allowed)
W/arcab.karcabbe( 6856): Accessing hidden method Ldalvik/system/BlockGuard$Policy;->onNetwork()V (greylist, linking, allowed)
D/AndroidRuntime( 6856): Shutting down VM
E/AndroidRuntime( 6856): FATAL EXCEPTION: main
E/AndroidRuntime( 6856): Process: com.karcab.karcabber, PID: 6856
E/AndroidRuntime( 6856): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/browser/customtabs/CustomTabsIntent$Builder;
E/AndroidRuntime( 6856): 	at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth@@20.0.1:13)
E/AndroidRuntime( 6856): 	at com.google.android.gms.internal.firebase-auth-api.zzth.zzb(com.google.firebase:firebase-auth@@20.0.1:7)
E/AndroidRuntime( 6856): 	at com.google.android.gms.internal.firebase-auth-api.zzth.onPostExecute(Unknown Source:2)
E/AndroidRuntime( 6856): 	at android.os.AsyncTask.finish(AsyncTask.java:755)
E/AndroidRuntime( 6856): 	at android.os.AsyncTask.access$900(AsyncTask.java:192)
E/AndroidRuntime( 6856): 	at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
E/AndroidRuntime( 6856): 	at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime( 6856): 	at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 6856): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 6856): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 6856): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 6856): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/AndroidRuntime( 6856): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder" on path: DexPathList[[zip file "/data/app/com.karcab.karcabber-1lBvoZbKY1hFgdUv40FOnA==/base.apk"],nativeLibraryDirectories=[/data/app/com.karcab.karcabber-1lBvoZbKY1hFgdUv40FOnA==/lib/x86, /data/app/com.karcab.karcabber-1lBvoZbKY1hFgdUv40FOnA==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
E/AndroidRuntime( 6856): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
E/AndroidRuntime( 6856): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime( 6856): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime( 6856): 	... 12 more
I/Process ( 6856): Sending signal. PID: 6856 SIG: 9

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19042.685], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.52.1)
[√] Connected device (1 available)

• No issues found!

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 2.10.4
Flutter SDK 1.22.5
KarCabber 1.0.0+1

dependencies:
- cloud_firestore 0.16.0 [flutter meta quiver firebase_core firebase_core_platform_interface cloud_firestore_platform_interface cloud_firestore_web]
- common 1.0.0+1 [flutter firebase_core firebase_auth cloud_firestore country_code_picker carousel_slider cupertino_icons]
- cupertino_icons 1.0.0
- firebase_auth 0.20.0 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.7.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]

dev dependencies:
- flutter_launcher_icons 0.8.1 [image args yaml path]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span
 stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- archive 2.0.13 [crypto args path]
- args 1.6.0
- async 2.5.0-nullsafety.1 [collection]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- carousel_slider 2.3.1 [flutter]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- clock 1.1.0-nullsafety.1
- cloud_firestore_platform_interface 3.0.1 [flutter meta collection firebase_core plugin_platform_interface]
- cloud_firestore_web 0.3.0+1 [flutter flutter_web_plugins http_parser meta firebase_core firebase_core_web cloud_firestore_platform_interface js]
- collection 1.15.0-nullsafety.3
- convert 2.1.1 [charcode typed_data]
- country_code_picker 1.7.0 [flutter modal_bottom_sheet]
- crypto 2.1.5 [collection convert typed_data]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- firebase_auth_platform_interface 3.0.1 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.2+6 [flutter flutter_web_plugins meta http_parser intl firebase_core firebase_core_web firebase_auth_platform_interface js]
- firebase_core_platform_interface 3.0.1 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+3 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image 2.1.19 [archive xml meta]
- intl 0.16.1 [path]
- js 0.6.2
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- modal_bottom_sheet 1.0.0+1 [flutter]
- path 1.8.0-nullsafety.1
- petitparser 3.1.0 [meta]
- plugin_platform_interface 1.0.3 [meta]
- quiver 2.1.5 [matcher meta]
- sky_engine 0.0.99
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- stack_trace 1.10.0-nullsafety.1 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0-nullsafety.3 [collection]
- vector_math 2.1.0-nullsafety.3
- xml 4.5.1 [collection convert meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]```

</details>

---
@mbilalakmal mbilalakmal added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Jan 13, 2021
@Salakar
Copy link
Member

Salakar commented Jan 14, 2021

This does look related to the Firebase Android SDK. @mikehardy thoughts - have you seen this one before?

@mikehardy
Copy link
Contributor

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
Upstream issue as linked above

Workaround that you must use until resolved, add dependency on browser into app/build.gradle:

 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

@markusaksli-nc
Copy link
Contributor

markusaksli-nc commented Jan 14, 2021

Reproducible on the latest master 1.26.0-2.0.pre.339 with firebase_auth: ^0.20.0+1.

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!
Logs
E/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.

@varadkulk
Copy link

varadkulk commented Jan 19, 2021

Enable Android Device Verification API on Google Cloud here

This solves the issue

@lancechentw
Copy link

androidx.browser:browser is mandatory when testing Firebase phone authentication in a android emulator, since the underlying com.google.firebase.firebase-auth performs a check on basicIntegrity value returned by Safetynet Attestation API, which is false in emulator environment.

So doing the followings will make a real device works, but not a emulator device

  • Enable Android Device Verification API
  • Add the SHA-256 key to Firebase project
  • Update google-services.json

@devmgs
Copy link

devmgs commented Jan 22, 2021

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

@hukusuke1007
Copy link

same issue.

@mikehardy
Copy link
Contributor

@hukusuke1007 and same fix! Cheers

@mikehardy
Copy link
Contributor

mikehardy commented Feb 5, 2021

@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

@xJon
Copy link

xJon commented Feb 8, 2021

Adding implementation "androidx.browser:browser:1.3.0" to app/build.gradle does prevent the crash whilst redirecting to the browser, but verificationCompleted in FirebaseAuth.instance.verifyPhoneNumber no longer works as my SMS verification codes are no longer auto-retrieved.
Additionally the SMS verification messages no longer use the app name from the store, and instead use the Firebase Project ID, which is not ideal (123456 is your verification code for <Project ID>).
Any idea what causes these issues in the new package version? Thank you!

@mikehardy
Copy link
Contributor

@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

@xJon
Copy link

xJon commented Feb 9, 2021

@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

@mikehardy
Copy link
Contributor

@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

@markusaksli-nc
Copy link
Contributor

This seems to be fixed on firebase_auth: ^1.0.1? I removed the workaround and it worked without crashing.

@mikehardy
Copy link
Contributor

@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

@nipunasudha
Copy link

nipunasudha commented Mar 10, 2021

@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 androidx.browser:browser as a dependency in build.gradle file. Could not test the 1.0.1 yet because I'm waiting from some dependencies to go Null safe

@markusaksli-nc
Copy link
Contributor

@mikehardy The workaround you originally mentioned - to add

implementation "androidx.browser:browser:1.2.0"

to the dependencies in app/build.gradle. I also had to add

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.

@mikehardy
Copy link
Contributor

Thanks for the success report @markusaksli-nc - I'll see about removing that from other repos, cheers

@mikehardy
Copy link
Contributor

@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 ./gradlew :app:dependencies > dependencies.txt (for react-native-firebase at least, where the target is called app, flutter may vary) then you see that there are other dependencies that will bring in the androidx.browser library, which then makes auth work but only by luck. If you exclude those other modules and re-test it, then you crash.

Two examples that were in my project, the FB SDK (react-native-fbsdk) and in-app-messaging from firebase itself.

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.

@markusaksli-nc
Copy link
Contributor

Strange, I see zero results for browser or androidx.browser when searching Gradle dependencies. Am I missing something here?

dependencies.txt

@mikehardy
Copy link
Contributor

mikehardy commented Mar 18, 2021

Strange, I see zero results for browser or androidx.browser when searching Gradle dependencies. Am I missing something here?

@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.

@ValeraSetrakov
Copy link

Hello, I added "androidx.browser:browser:1.3.0", but it didn't help me

my error:

java.lang.RuntimeException: Unable to resume activity {com.wiby.android.app/com.google.firebase.auth.internal.RecaptchaActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.internal.firebase-auth-api.zzau com.google.android.gms.internal.firebase-auth-api.zzds.zza()' on a null object reference
 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4270)
 at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4302)
 at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
 at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
 at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
 at android.os.Handler.dispatchMessage(Handler.java:107)
 at android.os.Looper.loop(Looper.java:224)
 at android.app.ActivityThread.main(ActivityThread.java:7562)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.internal.firebase-auth-api.zzau com.google.android.gms.internal.firebase-auth-api.zzds.zza()' on a null object reference
 at com.google.firebase.auth.internal.zzk.zzb(com.google.firebase:firebase-auth@@20.0.3:2)
 at com.google.firebase.auth.internal.RecaptchaActivity.zzd(com.google.firebase:firebase-auth@@20.0.3:10)
 at com.google.android.gms.internal.firebase-auth-api.zztw.<init>(com.google.firebase:firebase-auth@@20.0.3:13)
 at com.google.firebase.auth.internal.RecaptchaActivity.onResume(com.google.firebase:firebase-auth@@20.0.3:43)
 at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1454)
 at android.app.Activity.performResume(Activity.java:8050)
 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4260)

i don't think that this error the same like author's error, but i think that they are similar

my dependencies looks like

implementation "androidx.browser:browser:1.3.0"
implementation platform("com.google.firebase:firebase-bom:26.7.0")
implementation 'com.google.firebase:firebase-auth-ktx'

@mikehardy
Copy link
Contributor

@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

@ValeraSetrakov
Copy link

@mikehardy thanks for answer! I created separate issue

@ghost
Copy link

ghost commented Mar 24, 2021

I've just started experiencing this issue...

Button OnPressed event exception for method call verifyPhoneNumber:

E/zzbf    (26766): SafetyNet Attestation fails basic integrity.
W/ActivityThread(26766): handleWindowVisibility: no activity for token android.os.BinderProxy@5acbc9a
W/le.mobile_firs(26766): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/le.mobile_firs(26766): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/System  (26766): Ignoring header X-Firebase-Locale because its value was null.
W/System  (26766): A resource failed to call end. 
D/EGL_emulation(26766): eglMakeCurrent: 0x79c7de428ea0: ver 3 0 (tinfo 0x79c7de4a1800)
E/FirebaseAuth(26766): [GetAuthDomainTask] Error getting project config. Failed with INVALID_CERT_HASH 400
E/zzf     (26766): Failed to get reCAPTCHA token with error [There was an error while trying to get your package certificate hash.]- calling backend without app verification
D/EGL_emulation(26766): eglMakeCurrent: 0x79c7de428ea0: ver 3 0 (tinfo 0x79c7de4a1800)
W/System  (26766): Ignoring header X-Firebase-Locale because its value was null.

I have both SHA1 and SHA256 fingerprints in my firebase console both for debug and release mode.
I've tried adding <implementation "androidx.browser:browser:1.3.0"> and it did not help. In my emulator I just see a (modal?) sliding down which I assume contains the captcha but is not drawn:

image

Tried on api 29 and 30. here are my dependency versions:

image

@mikehardy
Copy link
Contributor

@ivankragoff

This is an assertion:

I have both SHA1 and SHA256 fingerprints in my firebase console both for debug and release mode.

This appears concrete and in contradiction to your assertion:

E/FirebaseAuth(26766): [GetAuthDomainTask] Error getting project config. Failed with INVALID_CERT_HASH 400
E/zzf (26766): Failed to get reCAPTCHA token with error [There was an error while trying to get your package certificate hash.]- calling backend without app verification

I would triple-check your assertion, it appears something is wrong with your certificate hash configuration.

@kmelliti
Copy link

implementation "androidx.browser:browser:1.3.0"

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 !

@mikehardy
Copy link
Contributor

@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:

https://github.com/FirebaseExtended/flutterfire/blob/78c3cf8583d0336e65ebc4d927e921a9e7a4f861/packages/firebase_auth/firebase_auth/android/build.gradle#L52-L57

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)

@Yunus0or1
Copy link

Yunus0or1 commented Mar 28, 2021

@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).

1

@weronikazak
Copy link

@Yunus0or1 lifesaver! Worked like a charm in my case

@mikehardy
Copy link
Contributor

@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

@Yunus0or1
Copy link

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.

@mikehardy
Copy link
Contributor

@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.

@petermusembi69
Copy link

If you are trying @Yunus0or1 solution. After hitting 'Create credentials', you first have to create Auth Consent Screen before adding an android client.

@mdparthi
Copy link

mdparthi commented Mar 30, 2021

@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

@acoutts
Copy link

acoutts commented May 21, 2021

For anyone getting the captcha flow on every sign in, double check you've setup SafetyNet correctly:
https://firebase.google.com/docs/auth/android/phone-auth#enable-app-verification

@russellwheatley
Copy link
Member

I believe this has now been fixed with firebase android BOM >= 28.0.0 release which latest firebase_core is bound to.firebase_auth latest version was published last week. Will reopen if I'm incorrect.

@mikehardy
Copy link
Contributor

Yes confirmed fixed w/BoM28+ I verified it against the corresponding react-native-firebase bug via inspection of ./gradlew :app:dependencies after removing the workaround dependency we added there.

@popekabu
Copy link

I simply fix it by removing the platform from your google firebase console and recreate a new one again. Works like charm

@bettdouglas
Copy link

For anyone getting the captcha flow on every sign in, double check you've setup SafetyNet correctly:
https://firebase.google.com/docs/auth/android/phone-auth#enable-app-verification

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: auth type: bug Something isn't working type: crash A compile error or crash
Projects
None yet
Development

No branches or pull requests