Flutter firebase_auth crashed after removed SafetyNet

357 views Asked by At

My flutter app is using firebase_auth (v 4.2.1) plugin to verify the phone number and which worked perfectly. But then I got "Migrate your Google SafetyNet Attestation API" warning from Google Play. When I search, found that "SafetyNet" is used in this "firebase_auth" plugin. And as for a solution for this issue I found this link (Flutter Play Store Warning : play-services-safetynet 2022).

dependencies {
  implementation platform('com.google.firebase:firebase-bom:30.3.2')
  implementation 'com.google.firebase:firebase-auth'
}
configurations.all {
    exclude group: 'com.google.android.gms', module: 'play-services-safetynet'
}

It removes "SafetyNet" from the dependency list. Now the app is crashed when tried to verify the phone number and getting following error.

E/AndroidRuntime(15766): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/safetynet/SafetyNet;
E/AndroidRuntime(15766):    at com.google.firebase.auth.internal.zzf.zza(com.google.firebase:firebase-auth@@21.1.0:2)
E/AndroidRuntime(15766):    at com.google.firebase.auth.FirebaseAuth.zzI(com.google.firebase:firebase-auth@@21.1.0:26)
E/AndroidRuntime(15766):    at com.google.firebase.auth.PhoneAuthProvider.verifyPhoneNumber(com.google.firebase:firebase-auth@@21.1.0:2)
E/AndroidRuntime(15766):    at io.flutter.plugins.firebase.auth.PhoneNumberVerificationStreamHandler.onListen(PhoneNumberVerificationStreamHandler.java:180)
E/AndroidRuntime(15766):    at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:218)
E/AndroidRuntime(15766):    at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:197)
E/AndroidRuntime(15766):    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/AndroidRuntime(15766):    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/AndroidRuntime(15766):    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass)
E/AndroidRuntime(15766):    at android.os.Handler.handleCallback(Handler.java:751)
E/AndroidRuntime(15766):    at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(15766):    at android.os.Looper.loop(Looper.java:154)
E/AndroidRuntime(15766):    at android.app.ActivityThread.main(ActivityThread.java:6077)
E/AndroidRuntime(15766):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15766):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime(15766):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
E/AndroidRuntime(15766): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.safetynet.SafetyNet" on path: DexPathList[[zip file "/data/app/.../base.apk"],nativeLibraryDirectories=[/data/app/.../lib/x86, /data/app/.../base.apk!/lib/x86, /system/lib, /vendor/lib]]
E/AndroidRuntime(15766):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime(15766):    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
E/AndroidRuntime(15766):    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(15766):    ... 16 more

I'm not sure whether the fix for "SafetyNet" is correct or not. If it is correct, what is the fix for this new issue? OR what is the best fix for "SafetyNet" issue

0

There are 0 answers