I was trying to signIn with mobile in flutter. Every time I enter the mobile number It show those error messages and exit from the app. I used code from https://firebase.flutter.dev/docs/auth/phone documentation. Code are almost same as documentation.
E/zzf (31149): Problem retrieving SafetyNet Token: 7:
I/Timeline(31149): Timeline: Activity_launch_request time:483815514
W/ActivityThread(31149): SCHED: com.example.newdevice/.MainActivity [85, r=578ms, a=96ms, w=57017ms]
W/ActivityThread(31149): handleWindowVisibility: no activity for token android.os.BinderProxy@dc5d811
D/ForceDarkHelper(31149): updateByCheckExcludeList: pkg: com.example.newdevice activity: com.google.firebase.auth.internal.RecaptchaActivity@5ed566f
I/chatty (31149): uid=10315(com.example.newdevice) identical 1 line
D/ForceDarkHelper(31149): updateByCheckExcludeList: pkg: com.example.newdevice activity: com.google.firebase.auth.internal.RecaptchaActivity@5ed566f
W/ample.newdevic(31149): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
W/ample.newdevic(31149): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/ample.newdevic(31149): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/ample.newdevic(31149): Accessing hidden method Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J (greylist,core-platform-api, linking, allowed)
W/ample.newdevic(31149): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
W/ample.newdevic(31149): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/ample.newdevic(31149): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
......More error message.......
I am using updated version for everything like Java/Flutter/ Firebase sdk. Also I added SHA1 key in Firebase app and enabled phone auth. I also tried both physical and virtual device. But every time same problem.
Dependencies in app level build.gradel file
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:26.2.0')
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-analytics'
implementation 'androidx.browser:browser:1.3.0'
implementation 'com.android.support:multidex:1.0.3'
}
Flutter code portion for mobile verification:
FirebaseAuth _auth = FirebaseAuth.instance;
await _auth.verifyPhoneNumber(
phoneNumber: mobileController.text,
verificationCompleted:
(PhoneAuthCredential credential) {
print(credential);
},
verificationFailed: (FirebaseAuthException error) {
print(error);
},
codeSent:
(String verificationId, int resendToken) async {
print('Your otp sent');
String smsCode = '123456';
PhoneAuthCredential phoneAuthCredential = PhoneAuthProvider.credential(verificationId: verificationId, smsCode: smsCode);
// Sign the user in (or link) with the credential
await _auth.signInWithCredential(phoneAuthCredential);
},
timeout: const Duration(seconds: 120),
codeAutoRetrievalTimeout: (String verificationId) {
print(verificationId);
}
);
I sucked here. Tried almost everything I can.