I was having issues checking the signingReport for my application, I was trying to review all the SHA keys for my Android app so that I could implement Google Sign-In OAuth 2.0.
The following code was creating errors:
./gradlew singingReport
I decided it was probably best to upgrade my gradle version in my VS Code installation, as I didn't appear to be compatible with my Java installation.
Everything had worked fine up until this point, but it appears Google sign-in was the straw that broke the camels back.
If you have a reason to upgrade your gradle version there are a couple of things to do before proceeding:
java --version
Once you are happy that with what you have, and what you need - the next steps are required to update your app:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
./gradlew wrapper
./gradlew --version
Once everything is up-to-date, you can re-run ./gradlew singingReport
to determine all the SHA keys associated with your app - be aware, you don't just need release track keys, you are going to need debug ones too.
The output of this commant will provide details similar to the following:
Task :app:signingReport
Variant: debug
Config: debug
Store: C:\Android.android\debug.keystore
Alias: AndroidDebugKey
MD5: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
SHA1: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX...
SHA-256: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX...
Valid until: Tuesday, July 15, 2053
Variant: release
Config: release
Store: C:\Users\iainm\OneDrive\Documents\upload-keystore.jks
Alias: upload
MD5: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
SHA1: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX...
SHA-256: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX...
Valid until: Thursday, August 10, 2051
Variant: profile
Config: debug
Store: C:\Android.android\debug.keystore
Alias: AndroidDebugKey
MD5: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
SHA1: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX...
SHA-256: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX...
Valid until: Tuesday, July 15, 2053
NOTE: While there will be several tasks and varients, there will probably only be a few in SHA1 and SHA-256 keys in the end, copy these - along with any app signing keys from the Google Play Console (relative to your):
Once this has been achieved, follow your regular trusted sources for how to implement the sign-in function within your flutter app. I myself followed a few different guides, and leveraged ChatGPT for assistance in my specific application.
Here is a snippet of my sign-in function:
FuturesignInWithGoogle() async { try { final GoogleSignIn googleSignIn = GoogleSignIn( scopes: [ 'email', 'profile', ], ); // Trigger the authentication flow final GoogleSignInAccount? googleUser = await googleSignIn.signIn(); // If the user cancels the sign-in flow, googleUser will be null if (googleUser == null) { // User canceled the sign-in return; } // Obtain the auth details from the request final GoogleSignInAuthentication googleAuth = await googleUser.authentication; // Create a new credential final AuthCredential credential = GoogleAuthProvider.credential( accessToken: googleAuth.accessToken, idToken: googleAuth.idToken, ); // Sign in to Firebase with the Google [UserCredential] UserCredential userCredential = await FirebaseAuth.instance.signInWithCredential(credential); // Check if user details exist in Firestore DocumentSnapshot userDoc = await FirebaseFirestore.instance .collection("users") .doc(userCredential.user!.email) .get(); if (!userDoc.exists) { String username = googleUser.displayName!; String email = userCredential.user!.email!; String userId = userCredential.user!.uid; await FirebaseFirestore.instance.collection("users").doc(email).set({ 'username': username, 'email': email, 'userId': userId, }); } else { // Fetch user data and set global variables var userData = userDoc.data() as Map ; firebaseUsername = userData['username']; firebaseEmail = userData['email']; firebaseUserId = userData['userId']; } } catch (e) { displayMessage("Error signing in with Google: $e"); print('Error signing in with Google: $e'); } }