I want to use Google authentication in flutter.After setting up everything, I encounter platformException(network_error, com.google.android.gms.common.api.ApiException: 7: , null, null) in my code.
I'm running my app in debug mode.
-> I'm connected to a network and internet doesn't seem to be an issue
->I've provided internet permission in Mainifest
->I've added SHA1 and SHA256 keys in firebase settings.(got them using below command in linux)
(
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
)
->I've added google-services.json to my project and setup firebase settings.
->date and time are correct on my device
Checked many previous StackOverflow response, but most responses are for PlatformException(sign_in_failed...,API exception : 10) or other reasons, but not for PlatformException(network_error...,API exception : 7) . examples of solutions tried:
I don't know what is the problem.
Here's my code
class GoogleSignInProvider { static final googleSignIn=GoogleSignIn();
static GoogleSignInAccount? user;
static Future googleLogin() async{
try{
final googleUser=await googleSignIn.signIn(); //Exception is thrown on this line
if(googleUser==null) return;
user=googleUser;
final googleAuth=await googleUser.authentication;
final credential=GoogleAuthProvider.credential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken
);
await FirebaseAuth.instance.signInWithCredential(credential);
}
on Exception catch(e){
print(e);
}
}
}
Here's the output
[ +859 ms] W/ActivityThread( 8504): handleWindowVisibility: no activity for token android.os.BinderProxy@de192c7 [+4403 ms] I/DecorCaptionView( 8504): Choosing forced status bar color. [ +72 ms] I/DecorCaptionView( 8504): Choosing forced status bar color. [ ] I/flutter ( 8504): PlatformException(network_error, com.google.android.gms.common.api.ApiException: 7: , null, null)